|
|
@@ -0,0 +1,43 @@
|
|
|
+<?php
|
|
|
+
|
|
|
+namespace App\Http\Requests;
|
|
|
+
|
|
|
+use Illuminate\Foundation\Http\FormRequest;
|
|
|
+
|
|
|
+class FranchiseeTbrRequest extends FormRequest
|
|
|
+{
|
|
|
+ public function rules(): array
|
|
|
+ {
|
|
|
+ return [
|
|
|
+ 'franchisee_id' => ['required', 'integer', 'exists:franchisees,id'],
|
|
|
+ 'contract_id' => ['required', 'integer', 'exists:franchisee_contracts,id'],
|
|
|
+ 'inhabitant_classification_id' => ['required', 'integer', 'exists:inhabitant_classifications,id'],
|
|
|
+ 'year' => ['required', 'integer', 'min:2000', 'max:2100'],
|
|
|
+ 'tbr_value' => ['required', 'numeric', 'min:0'],
|
|
|
+ 'start_date' => ['required', 'date'],
|
|
|
+ 'invoice_due_day' => ['required', 'integer', 'min:1', 'max:31'],
|
|
|
+ 'base_royalties_percentage' => ['required', 'numeric', 'min:0', 'max:1'],
|
|
|
+ 'base_fnm_percentage' => ['required', 'numeric', 'min:0', 'max:1'],
|
|
|
+ ];
|
|
|
+ }
|
|
|
+
|
|
|
+ public function messages(): array
|
|
|
+ {
|
|
|
+ return [
|
|
|
+ 'franchisee_id.required' => 'O franqueado é obrigatório.',
|
|
|
+ 'franchisee_id.exists' => 'Franqueado não encontrado.',
|
|
|
+ 'contract_id.required' => 'O contrato é obrigatório.',
|
|
|
+ 'contract_id.exists' => 'Contrato não encontrado.',
|
|
|
+ 'inhabitant_classification_id.required' => 'A classificação de habitantes é obrigatória.',
|
|
|
+ 'inhabitant_classification_id.exists' => 'Classificação de habitantes não encontrada.',
|
|
|
+ 'year.required' => 'O ano é obrigatório.',
|
|
|
+ 'tbr_value.required' => 'O valor da TBR é obrigatório.',
|
|
|
+ 'start_date.required' => 'A data de início é obrigatória.',
|
|
|
+ 'invoice_due_day.required' => 'O dia de vencimento do boleto é obrigatório.',
|
|
|
+ 'invoice_due_day.min' => 'O dia de vencimento deve ser entre 1 e 31.',
|
|
|
+ 'invoice_due_day.max' => 'O dia de vencimento deve ser entre 1 e 31.',
|
|
|
+ 'base_royalties_percentage.required' => 'O percentual base de royalties é obrigatório.',
|
|
|
+ 'base_fnm_percentage.required' => 'O percentual base do FNM é obrigatório.',
|
|
|
+ ];
|
|
|
+ }
|
|
|
+}
|