diff --git a/app/Events/SeatingLimitChange.php b/app/Events/SeatingLimitChange.php new file mode 100644 index 0000000..5217dfe --- /dev/null +++ b/app/Events/SeatingLimitChange.php @@ -0,0 +1,36 @@ + + */ + public function broadcastOn(): array + { + return [ + new PrivateChannel('channel-name'), + ]; + } +} diff --git a/app/Listeners/RefreshSeatingLimitCache.php b/app/Listeners/RefreshSeatingLimitCache.php new file mode 100644 index 0000000..d309d15 --- /dev/null +++ b/app/Listeners/RefreshSeatingLimitCache.php @@ -0,0 +1,28 @@ +seatingService = $seatingService; + } + + /** + * Handle the event. + */ + public function handle(SeatingLimitChange $event): void + { + $this->seatingService->refreshLimits(); + } +} diff --git a/app/Observers/SeatingLimitObserver.php b/app/Observers/SeatingLimitObserver.php new file mode 100644 index 0000000..5b36ca7 --- /dev/null +++ b/app/Observers/SeatingLimitObserver.php @@ -0,0 +1,49 @@ +limitsCacheKey, now()->addDay(), function () { $limits = SeatingLimit::with('ensemble')->get(); // Sort limits by ensemble->rank