| 
									
										
										
										
											2020-07-11 15:13:15 +02:00
										 |  |  | <?php | 
					
						
							| 
									
										
										
										
											2024-11-25 04:18:55 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-07-11 15:13:15 +02:00
										 |  |  | /** | 
					
						
							|  |  |  |  * DataDestroyRequest.php | 
					
						
							|  |  |  |  * Copyright (c) 2020 james@firefly-iii.org | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * This file is part of Firefly III (https://github.com/firefly-iii). | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * This program is free software: you can redistribute it and/or modify | 
					
						
							|  |  |  |  * it under the terms of the GNU Affero General Public License as | 
					
						
							|  |  |  |  * published by the Free Software Foundation, either version 3 of the | 
					
						
							|  |  |  |  * License, or (at your option) any later version. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * This program is distributed in the hope that it will be useful, | 
					
						
							|  |  |  |  * but WITHOUT ANY WARRANTY; without even the implied warranty of | 
					
						
							|  |  |  |  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
					
						
							|  |  |  |  * GNU Affero General Public License for more details. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * You should have received a copy of the GNU Affero General Public License | 
					
						
							|  |  |  |  * along with this program.  If not, see <https://www.gnu.org/licenses/>. | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | declare(strict_types=1); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-03-07 08:16:33 +01:00
										 |  |  | namespace FireflyIII\Api\V1\Requests\Data; | 
					
						
							| 
									
										
										
										
											2020-07-11 15:13:15 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-11-08 13:36:13 +01:00
										 |  |  | use FireflyIII\Support\Request\ChecksLogin; | 
					
						
							| 
									
										
										
										
											2020-07-18 08:34:00 +02:00
										 |  |  | use FireflyIII\Support\Request\ConvertsDataTypes; | 
					
						
							| 
									
										
										
										
											2020-07-18 08:25:25 +02:00
										 |  |  | use Illuminate\Foundation\Http\FormRequest; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-07-11 15:13:15 +02:00
										 |  |  | /** | 
					
						
							| 
									
										
										
										
											2021-03-07 08:16:33 +01:00
										 |  |  |  * Class DestroyRequest | 
					
						
							| 
									
										
										
										
											2020-07-11 15:13:15 +02:00
										 |  |  |  */ | 
					
						
							| 
									
										
										
										
											2021-03-07 08:16:33 +01:00
										 |  |  | class DestroyRequest extends FormRequest | 
					
						
							| 
									
										
										
										
											2020-07-11 15:13:15 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2022-10-30 14:23:00 +01:00
										 |  |  |     use ChecksLogin; | 
					
						
							| 
									
										
										
										
											2023-11-04 14:18:49 +01:00
										 |  |  |     use ConvertsDataTypes; | 
					
						
							| 
									
										
										
										
											2020-07-11 15:13:15 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * Get all data from the request. | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     public function getObjects(): string | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         return $this->get('objects') ?? ''; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * The rules that the incoming request must be matched against. | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     public function rules(): array | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2025-02-23 12:28:43 +01:00
										 |  |  |         $valid = 'budgets,bills,piggy_banks,rules,recurring,categories,tags,object_groups' | 
					
						
							|  |  |  |                  .',accounts,asset_accounts,expense_accounts,revenue_accounts,liabilities,transactions,withdrawals,deposits,transfers' | 
					
						
							|  |  |  |                  .',not_assets_liabilities'; | 
					
						
							| 
									
										
										
										
											2020-07-11 15:13:15 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |         return [ | 
					
						
							| 
									
										
										
										
											2023-04-26 06:17:04 +02:00
										 |  |  |             'objects' => sprintf('required|max:255|min:1|string|in:%s', $valid), | 
					
						
							| 
									
										
										
										
											2022-10-19 19:57:22 +02:00
										 |  |  |             'unused'  => 'in:true,false', | 
					
						
							| 
									
										
										
										
											2020-07-11 15:13:15 +02:00
										 |  |  |         ]; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | } |