- account_type, balance, currency, opened_at, branch_name, memo, sort_order, last_transaction_at 추가 - Model: fillable, casts, hidden, scopes, accessors를 MNG 모델 기준으로 통일 - Service: store/update에 누락 필드 반영 - FormRequest: Store/Update에 검증 규칙 추가
54 lines
2.0 KiB
PHP
54 lines
2.0 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Requests\V1\BankAccount;
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
class UpdateBankAccountRequest extends FormRequest
|
|
{
|
|
public function authorize(): bool
|
|
{
|
|
return true;
|
|
}
|
|
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
'bank_code' => ['sometimes', 'string', 'max:10'],
|
|
'bank_name' => ['sometimes', 'string', 'max:50'],
|
|
'account_number' => ['sometimes', 'string', 'max:30', 'regex:/^[\d-]+$/'],
|
|
'account_holder' => ['sometimes', 'string', 'max:50'],
|
|
'account_name' => ['sometimes', 'string', 'max:100'],
|
|
'account_type' => ['sometimes', 'nullable', 'string', 'max:30'],
|
|
'balance' => ['sometimes', 'nullable', 'numeric', 'min:0'],
|
|
'currency' => ['sometimes', 'nullable', 'string', 'max:3'],
|
|
'opened_at' => ['sometimes', 'nullable', 'date'],
|
|
'branch_name' => ['sometimes', 'nullable', 'string', 'max:100'],
|
|
'memo' => ['sometimes', 'nullable', 'string', 'max:500'],
|
|
'status' => ['sometimes', 'string', 'in:active,inactive'],
|
|
'assigned_user_id' => ['nullable', 'integer', 'exists:users,id'],
|
|
'sort_order' => ['sometimes', 'nullable', 'integer', 'min:0'],
|
|
];
|
|
}
|
|
|
|
public function messages(): array
|
|
{
|
|
return [
|
|
'account_number.regex' => __('validation.account_number_format'),
|
|
];
|
|
}
|
|
|
|
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'),
|
|
];
|
|
}
|
|
}
|