58 lines
1.3 KiB
PHP
58 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Requests;
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
class StoreLemburRequest extends FormRequest
|
|
{
|
|
|
|
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 [
|
|
'tanggal_lembur' => 'required|date',
|
|
'jam_mulai' => 'required|date_format:H:i',
|
|
'jam_selesai' => 'required|date_format:H:i|after:jam_mulai',
|
|
'keterangan' => 'nullable|string|max:255',
|
|
'id_kompensasi' => 'nullable|exists:jenis_kompensasi,id_kompensasi',
|
|
];
|
|
}
|
|
|
|
/**
|
|
* Get custom attributes for validator errors.
|
|
*
|
|
* @return array
|
|
*/
|
|
public function attributes()
|
|
{
|
|
return [
|
|
'tanggal_lembur' => 'tanggal lembur',
|
|
'jam_mulai' => 'jam mulai',
|
|
'jam_selesai' => 'jam selesai',
|
|
'id_kompensasi' => 'jenis kompensasi',
|
|
];
|
|
}
|
|
|
|
/**
|
|
* Get custom messages for validator errors.
|
|
*
|
|
* @return array
|
|
*/
|
|
public function messages(): array
|
|
{
|
|
return [
|
|
'jam_selesai.after' => 'Jam selesai harus lebih dari jam mulai.',
|
|
];
|
|
}
|
|
}
|