zedmagdy/filament-business-hours
opens_at, closes_at columns).DateTime and Carbon for timezone logic. Ensure the app consistently uses a single timezone library (e.g., avoid mixing Carbon and DateTime).Filament Adoption:
Data Model:
Timezone Strategy:
Edge Cases:
opens_at > closes_at) be handled?Performance:
WHERE business_hours->>'monday'->>'opens_at') impact performance?HasBusinessHours trait (e.g., Branch, Store, Agent).FilamentBusinessHoursPlugin in the Filament provider with the default timezone.BusinessHoursField and BusinessHourColumn.Branch::query()->each(function ($branch) {
$branch->business_hours = [
'timezone' => 'America/New_York',
'days' => [
'monday' => ['opens_at' => '09:00', 'closes_at' => '17:00'],
// ...
],
'exceptions' => [] // populate as needed
];
$branch->save();
});
TestLocation).
Branch, Agent).
DB::select for complex filtering).use ZEDMagdy\FilamentBusinessHours\Validation\BusinessHoursValidator;
$request->validate([
'business_hours' => ['required', new BusinessHoursValidator],
]);
branches_open_now materialized view).class Branch extends Model {
use HasBusinessHours;
public $timestamps = false; // or use `updated_at` for locking
}
How can I help you explore Laravel packages today?