60 lines
1.5 KiB
PHP
60 lines
1.5 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Requests;
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
class UpdatePengajuanIzinRequest extends FormRequest
|
|
{
|
|
|
|
public function authorize(): bool
|
|
{
|
|
return true;
|
|
}
|
|
|
|
/**
|
|
* Get the validation rules that apply to the request.
|
|
*
|
|
* @return array
|
|
*/
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
'tanggal_mulai' => 'required|date',
|
|
'tanggal_selesai' => 'required|date|after_or_equal:tanggal_mulai',
|
|
'id_jenis_izin' => 'required|exists:jenis_izin,id_jenis_izin',
|
|
'alasan' => 'required|string|max:150',
|
|
'bukti_file' => 'nullable|file|mimes:pdf,jpg,jpeg,png|max:2048',
|
|
];
|
|
}
|
|
|
|
/**
|
|
* Get custom attributes for validator errors.
|
|
*
|
|
* @return array
|
|
*/
|
|
public function attributes()
|
|
{
|
|
return [
|
|
'tanggal_mulai' => 'tanggal mulai',
|
|
'tanggal_selesai' => 'tanggal selesai',
|
|
'id_jenis_izin' => 'jenis izin',
|
|
'bukti_file' => 'bukti file',
|
|
];
|
|
}
|
|
|
|
/**
|
|
* Get custom messages for validator errors.
|
|
*
|
|
* @return array
|
|
*/
|
|
public function messages(): array
|
|
{
|
|
return [
|
|
'tanggal_selesai.after_or_equal' => 'Tanggal selesai harus sama atau setelah tanggal mulai.',
|
|
'bukti_file.max' => 'Ukuran file maksimal 2MB.',
|
|
'bukti_file.mimes' => 'Format file harus PDF, JPG, JPEG, atau PNG.',
|
|
];
|
|
}
|
|
}
|