- Bill 확장 필드 (V8), Loan 상품권 카테고리/접대비 자동 연동 - GeneralJournalEntry CRUD, AccountSubject API - 접대비/복리후생비 날짜 필터, 매출채권 soft delete 제외 - 바로빌 연동 API 엔드포인트 추가 - 부가세 상세 조회 API Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
66 lines
2.5 KiB
PHP
66 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 LoanStoreRequest 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
|
|
{
|
|
$isGiftCertificate = $this->input('category') === Loan::CATEGORY_GIFT_CERTIFICATE;
|
|
|
|
return [
|
|
'user_id' => [$isGiftCertificate ? 'nullable' : 'required', 'integer', 'exists:users,id'],
|
|
'loan_date' => ['required', 'date', 'date_format:Y-m-d'],
|
|
'amount' => ['required', 'numeric', 'min:0', 'max:999999999999.99'],
|
|
'purpose' => ['nullable', 'string', 'max:1000'],
|
|
'withdrawal_id' => ['nullable', 'integer', 'exists:withdrawals,id'],
|
|
'category' => ['nullable', 'string', Rule::in(Loan::CATEGORIES)],
|
|
'status' => ['nullable', 'string', Rule::in(Loan::STATUSES)],
|
|
'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'),
|
|
];
|
|
}
|
|
}
|