Files
sam-api/app/Http/Requests/V1/BankAccount/StoreBankAccountRequest.php

61 lines
2.6 KiB
PHP
Raw Normal View History

<?php
namespace App\Http\Requests\V1\BankAccount;
use Illuminate\Foundation\Http\FormRequest;
class StoreBankAccountRequest extends FormRequest
{
public function authorize(): bool
{
return true;
}
public function rules(): array
{
return [
'bank_code' => ['required', 'string', 'max:10'],
'bank_name' => ['required', 'string', 'max:50'],
'account_number' => ['required', 'string', 'max:30', 'regex:/^[\d-]+$/'],
'account_holder' => ['required', 'string', 'max:50'],
'account_name' => ['required', 'string', 'max:100'],
'account_type' => ['nullable', 'string', 'max:30'],
'balance' => ['nullable', 'numeric', 'min:0'],
'currency' => ['nullable', 'string', 'max:3'],
'opened_at' => ['nullable', 'date'],
'branch_name' => ['nullable', 'string', 'max:100'],
'memo' => ['nullable', 'string', 'max:500'],
'status' => ['nullable', 'string', 'in:active,inactive'],
'assigned_user_id' => ['nullable', 'integer', 'exists:users,id'],
'is_primary' => ['nullable', 'boolean'],
'sort_order' => ['nullable', 'integer', 'min:0'],
];
}
public function messages(): array
{
return [
'bank_code.required' => __('validation.required', ['attribute' => __('validation.attributes.bank_code')]),
'bank_name.required' => __('validation.required', ['attribute' => __('validation.attributes.bank_name')]),
'account_number.required' => __('validation.required', ['attribute' => __('validation.attributes.account_number')]),
'account_number.regex' => __('validation.account_number_format'),
'account_holder.required' => __('validation.required', ['attribute' => __('validation.attributes.account_holder')]),
'account_name.required' => __('validation.required', ['attribute' => __('validation.attributes.account_name')]),
];
}
public function attributes(): array
{
return [
'bank_code' => __('validation.attributes.bank_code'),
'bank_name' => __('validation.attributes.bank_name'),
'account_number' => __('validation.attributes.account_number'),
'account_holder' => __('validation.attributes.account_holder'),
'account_name' => __('validation.attributes.account_name'),
'status' => __('validation.attributes.status'),
'assigned_user_id' => __('validation.attributes.assigned_user_id'),
'is_primary' => __('validation.attributes.is_primary'),
];
}
}