From 52f6506b3cfaba39e4a8f88182e58547fcf2d2c5 Mon Sep 17 00:00:00 2001 From: Paulo Castellano Date: Fri, 24 Jul 2026 12:08:16 -0300 Subject: [PATCH] Scope after-commit to PostCreated instead of the whole observer. Restore the saved() automation afterCommit hook and let the event wait for commit on its own. Co-authored-by: Cursor --- app/Events/PostCreated.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/Events/PostCreated.php b/app/Events/PostCreated.php index 013f20d5..6234ba0e 100644 --- a/app/Events/PostCreated.php +++ b/app/Events/PostCreated.php @@ -8,10 +8,11 @@ use Illuminate\Broadcasting\InteractsWithSockets; use Illuminate\Broadcasting\PrivateChannel; use Illuminate\Contracts\Broadcasting\ShouldBroadcast; +use Illuminate\Contracts\Events\ShouldDispatchAfterCommit; use Illuminate\Foundation\Events\Dispatchable; use Illuminate\Queue\SerializesModels; -class PostCreated implements ShouldBroadcast +class PostCreated implements ShouldBroadcast, ShouldDispatchAfterCommit { use Dispatchable, InteractsWithSockets, SerializesModels;