Two events are dispatched after the write commits, with scalar payloads that are safe to queue:
- OpeningHoursUpdated(calendarId, ownerType, ownerId, calendarKey, revision) — a definition changed: a sync, an added or removed exception, a prune, a refresh or a direct row edit.
- OpeningHoursDeleted(calendarId, ownerType, ownerId, calendarKey, forced) — a calendar was soft-deleted (forced: false) or removed for good.
use Illuminate\Support\Facades\Event;
use RoundlyConsulting\OpeningHours\Events\OpeningHoursDeleted;
use RoundlyConsulting\OpeningHours\Events\OpeningHoursUpdated;
Event::listen(function (OpeningHoursUpdated $event): void {
logger()->info('Opening hours changed', [
'owner' => $event->ownerType.':'.$event->ownerId,
'calendar' => $event->calendarKey,
'revision' => $event->revision,
]);
});
Event::listen(function (OpeningHoursDeleted $event): void {
// $event->forced — true when removed for good, false for a soft delete
});Use them to refresh search indexes, caches or partner feeds. With materialize.enabled, the package itself listens to OpeningHoursUpdated and queues a MaterializeIntervalsJob for that calendar.
Show your open-source love
This package is free and MIT-licensed. If it saves you time, a one-off donation or a Patreon membership keeps it maintained, tested and documented.
More ways to support, including cryptoBy donating, you agree to our donation terms.
Want this built into your product?
We integrate our packages into custom Laravel and AI builds. Tell us what you're working on and we'll reply within 48 hours.