- 테이블 3개: bad_debts, bad_debt_documents, bad_debt_memos - 모델 3개: BadDebt, BadDebtDocument, BadDebtMemo - BadDebtService: CRUD, 요약 통계, 서류/메모 관리 - API 엔드포인트 11개 (목록, 등록, 상세, 수정, 삭제, 토글, 서류/메모 CRUD) - Swagger 문서 작성 완료
47 lines
1.3 KiB
PHP
47 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Requests\V1\BadDebt;
|
|
|
|
use App\Models\BadDebts\BadDebtDocument;
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
use Illuminate\Validation\Rule;
|
|
|
|
class StoreBadDebtDocumentRequest 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 [
|
|
'document_type' => ['required', 'string', Rule::in(array_keys(BadDebtDocument::DOCUMENT_TYPES))],
|
|
'file_id' => ['required', 'integer', 'exists:files,id'],
|
|
];
|
|
}
|
|
|
|
/**
|
|
* Get custom messages for validator errors.
|
|
*
|
|
* @return array<string, string>
|
|
*/
|
|
public function messages(): array
|
|
{
|
|
return [
|
|
'document_type.required' => __('validation.required', ['attribute' => '서류유형']),
|
|
'document_type.in' => __('validation.in', ['attribute' => '서류유형']),
|
|
'file_id.required' => __('validation.required', ['attribute' => '파일']),
|
|
'file_id.exists' => __('validation.exists', ['attribute' => '파일']),
|
|
];
|
|
}
|
|
}
|