- Bill 모델: V8 확장 필드 54개 추가 (증권종류, 할인, 배서, 추심, 개서, 부도 등) - Bill 상태: 수취/발행 어음·수표별 세분화된 상태 체계 - BillService: assignV8Fields/syncInstallments 헬퍼 추출, instrument_type/medium 필터 - BillInstallment: type/counterparty 필드 추가 - Loan 모델: holding/used/disposed 상태 + metadata(JSON) 필드 추가 - LoanService: 상품권 카테고리 지원 (summary 상태별 집계, store 기본상태 holding) - FormRequest: V8 확장 필드 검증 규칙 추가 - 마이그레이션: bills V8 필드 + loans metadata 컬럼 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
65 lines
2.5 KiB
PHP
65 lines
2.5 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Requests\Loan;
|
|
|
|
use App\Models\Tenants\Loan;
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
use Illuminate\Validation\Rule;
|
|
|
|
class LoanUpdateRequest extends FormRequest
|
|
{
|
|
/**
|
|
* Determine if the user is authorized to make this request.
|
|
*/
|
|
public function authorize(): bool
|
|
{
|
|
return true;
|
|
}
|
|
|
|
/**
|
|
* Get the validation rules that apply to the request.
|
|
*
|
|
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
|
|
*/
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
'user_id' => ['sometimes', 'integer', 'exists:users,id'],
|
|
'loan_date' => ['sometimes', 'date', 'date_format:Y-m-d'],
|
|
'amount' => ['sometimes', 'numeric', 'min:0', 'max:999999999999.99'],
|
|
'purpose' => ['nullable', 'string', 'max:1000'],
|
|
'withdrawal_id' => ['nullable', 'integer', 'exists:withdrawals,id'],
|
|
'category' => ['sometimes', 'string', Rule::in(Loan::CATEGORIES)],
|
|
'status' => ['sometimes', 'string', Rule::in(Loan::STATUSES)],
|
|
'settlement_date' => ['nullable', 'date', 'date_format:Y-m-d'],
|
|
'metadata' => ['nullable', 'array'],
|
|
'metadata.serial_number' => ['nullable', 'string', 'max:100'],
|
|
'metadata.cert_name' => ['nullable', 'string', 'max:200'],
|
|
'metadata.vendor_id' => ['nullable', 'string', 'max:50'],
|
|
'metadata.vendor_name' => ['nullable', 'string', 'max:200'],
|
|
'metadata.purchase_purpose' => ['nullable', 'string', 'max:50'],
|
|
'metadata.entertainment_expense' => ['nullable', 'string', 'max:50'],
|
|
'metadata.recipient_name' => ['nullable', 'string', 'max:100'],
|
|
'metadata.recipient_organization' => ['nullable', 'string', 'max:200'],
|
|
'metadata.usage_description' => ['nullable', 'string', 'max:1000'],
|
|
'metadata.memo' => ['nullable', 'string', 'max:2000'],
|
|
];
|
|
}
|
|
|
|
/**
|
|
* Get the validation attribute names.
|
|
*
|
|
* @return array<string, string>
|
|
*/
|
|
public function attributes(): array
|
|
{
|
|
return [
|
|
'user_id' => __('validation.attributes.user_id'),
|
|
'loan_date' => __('validation.attributes.loan_date'),
|
|
'amount' => __('validation.attributes.amount'),
|
|
'purpose' => __('validation.attributes.purpose'),
|
|
'withdrawal_id' => __('validation.attributes.withdrawal_id'),
|
|
];
|
|
}
|
|
}
|