35 lines
746 B
PHP
35 lines
746 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use App\Enums\DataSource;
|
|
use App\Enums\WorkDayType;
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
|
|
class WorkCalendar extends BaseAuditable
|
|
{
|
|
use SoftDeletes;
|
|
|
|
protected $casts = [
|
|
'date' => 'date',
|
|
'type' => WorkDayType::class,
|
|
'data_source' => DataSource::class,
|
|
];
|
|
|
|
/**
|
|
* Meghatározza, hogy az adott nap munkaszüneti nap-e az adatbázis szerint.
|
|
*/
|
|
public function isHoliday(): bool
|
|
{
|
|
return $this->type === WorkDayType::Holiday;
|
|
}
|
|
|
|
/**
|
|
* Meghatározza, hogy az adott nap plusz munkanap-e az adatbázis szerint.
|
|
*/
|
|
public function isWorkingDay(): bool
|
|
{
|
|
return $this->type === WorkDayType::WorkingDay;
|
|
}
|
|
}
|