libra/app/Models/WorkingHour.php

35 lines
624 B
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class WorkingHour extends Model
{
use HasFactory;
protected $fillable = [
'day_of_week',
'start_time',
'end_time',
'is_active',
];
protected function casts(): array
{
return [
'day_of_week' => 'integer',
'is_active' => 'boolean',
];
}
/**
* Scope to filter active working hours.
*/
public function scopeActive($query)
{
return $query->where('is_active', true);
}
}