39 lines
1.2 KiB
PHP
39 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Services\System\Setting;
|
|
|
|
use App\Services\Concerns\CachesQuery;
|
|
use App\Settings\HrSettings;
|
|
|
|
class HrSettingService
|
|
{
|
|
use CachesQuery;
|
|
|
|
public function hrData(): array
|
|
{
|
|
return $this->cacheRemember('system:hr_settings', 86400, function () {
|
|
$settings = app(HrSettings::class);
|
|
|
|
return [
|
|
'scheduled_check_in_time' => $settings->scheduled_check_in_time,
|
|
'scheduled_check_out_time' => $settings->scheduled_check_out_time,
|
|
'late_penalty_amount' => $settings->late_penalty_amount,
|
|
'absent_penalty_amount' => $settings->absent_penalty_amount,
|
|
];
|
|
});
|
|
}
|
|
|
|
public function updateHr(array $validated): void
|
|
{
|
|
$settings = app(HrSettings::class);
|
|
|
|
$settings->scheduled_check_in_time = $validated['scheduled_check_in_time'];
|
|
$settings->scheduled_check_out_time = $validated['scheduled_check_out_time'];
|
|
$settings->late_penalty_amount = (int) $validated['late_penalty_amount'];
|
|
$settings->absent_penalty_amount = (int) $validated['absent_penalty_amount'];
|
|
$settings->save();
|
|
|
|
$this->cacheForget('system:hr_settings');
|
|
}
|
|
}
|