From 398be55a42e63fb2ba46e7e98916ba1395e98636 Mon Sep 17 00:00:00 2001 From: Chris Morrell Date: Fri, 12 Apr 2024 14:11:30 -0400 Subject: [PATCH] Queue events before calling fired hooks --- src/Lifecycle/Broker.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Lifecycle/Broker.php b/src/Lifecycle/Broker.php index 10fccbd0..7300fd74 100644 --- a/src/Lifecycle/Broker.php +++ b/src/Lifecycle/Broker.php @@ -37,10 +37,10 @@ public function fire(Event $event): ?Event $states->each(fn ($state) => $this->dispatcher->apply($event, $state)); - $this->dispatcher->fired($event, $states); - app(Queue::class)->queue($event); + $this->dispatcher->fired($event, $states); + if ($this->commit_immediately || $event instanceof CommitsImmediately) { $this->commit(); }