44 lines
1.2 KiB
PHP
44 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Requests\Admin\Settings;
|
|
|
|
use App\Concerns\CurrencyStripping;
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
use Override;
|
|
|
|
class UpdateHRRequest extends FormRequest
|
|
{
|
|
use CurrencyStripping;
|
|
|
|
public function authorize(): bool
|
|
{
|
|
return $this->user()->can('settings.update_hr');
|
|
}
|
|
|
|
#[Override]
|
|
public function prepareForValidation(): void
|
|
{
|
|
$this->merge($this->stripCurrencyDot($this->all(), 'late_penalty_amount', 'absent_penalty_amount'));
|
|
}
|
|
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
'scheduled_check_in_time' => ['required', 'string', 'max:5'],
|
|
'scheduled_check_out_time' => ['required', 'string', 'max:5'],
|
|
'late_penalty_amount' => ['required', 'integer', 'min:0'],
|
|
'absent_penalty_amount' => ['required', 'integer', 'min:0'],
|
|
];
|
|
}
|
|
|
|
public function attributes(): array
|
|
{
|
|
return [
|
|
'scheduled_check_in_time' => 'jam masuk kerja',
|
|
'scheduled_check_out_time' => 'jam pulang kerja',
|
|
'late_penalty_amount' => 'denda keterlambatan',
|
|
'absent_penalty_amount' => 'denda bolos',
|
|
];
|
|
}
|
|
}
|