StoreFranchisorReceivableRequest.php 865 B

123456789101112131415161718192021222324252627
  1. <?php
  2. namespace App\Http\Requests;
  3. use Illuminate\Foundation\Http\FormRequest;
  4. use Illuminate\Validation\Rule;
  5. class StoreFranchisorReceivableRequest extends FormRequest
  6. {
  7. public function rules(): array
  8. {
  9. return [
  10. 'account_type' => ['required', Rule::in(['internal', 'unit'])],
  11. 'unit_id' => [
  12. Rule::requiredIf($this->input('account_type') === 'unit'),
  13. 'nullable',
  14. 'integer',
  15. 'exists:units,id',
  16. ],
  17. 'history' => ['required', 'string', 'max:255'],
  18. 'value' => ['required', 'numeric', 'min:0.01'],
  19. 'due_date' => ['required', 'date'],
  20. 'financial_plan_account_id' => ['nullable', 'integer', 'exists:financial_plan_accounts,id'],
  21. 'obs' => ['nullable', 'string', 'max:1000'],
  22. ];
  23. }
  24. }