Files
sam-api/app/Http/Requests/V1/BadDebt/StoreBadDebtDocumentRequest.php

47 lines
1.3 KiB
PHP
Raw Normal View History

<?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' => '파일']),
];
}
}