ProviderBankAccountStoreRequest.php 970 B

123456789101112131415161718192021222324252627
  1. <?php
  2. namespace App\Http\Requests;
  3. use Illuminate\Foundation\Http\FormRequest;
  4. use Illuminate\Validation\Rule;
  5. class ProviderBankAccountStoreRequest extends FormRequest
  6. {
  7. public function authorize(): bool
  8. {
  9. return true;
  10. }
  11. public function rules(): array
  12. {
  13. return [
  14. 'bank_id' => ['required_without:bank_code', 'nullable', 'integer', Rule::exists('banks', 'id')->where('active', true)->whereNull('deleted_at')],
  15. 'bank_code' => ['required_without:bank_id', 'nullable', 'string', 'max:3'],
  16. 'type' => ['required', Rule::in(['checking', 'savings'])],
  17. 'branch_number' => ['required', 'string', 'max:4'],
  18. 'branch_check_digit' => ['sometimes', 'nullable', 'string', 'max:2'],
  19. 'account_number' => ['required', 'string', 'max:13'],
  20. 'account_check_digit' => ['required', 'string', 'max:2'],
  21. ];
  22. }
  23. }