bug fixes, daily reports, holidays

This commit is contained in:
Kwesi Banson Jnr
2026-09-08 08:01:08 +00:00
parent 26f23c825a
commit c96e49ccdf
23 changed files with 1148 additions and 160 deletions

View File

@@ -29,4 +29,21 @@ class OfficeLocation extends Model
{
return $this->hasMany(OfficeLocationDocument::class, 'office_location_id');
}
public function holidays()
{
return $this->hasMany(PublicHoliday::class)->orderBy('holiday_date');
}
public function isHoliday($date)
{
$parsedDate = \Carbon\Carbon::parse($date);
return $this->holidays()->where(function($query) use ($parsedDate) {
$query->whereDate('holiday_date', $parsedDate->format('Y-m-d'))
->orWhere(function($q) use ($parsedDate) {
$q->where('is_recurring', true)
->whereMonth('holiday_date', $parsedDate->month)
->whereDay('holiday_date', $parsedDate->day);
});
})->exists();
}
}