From 3b281faf0035dd468b6488efaf216b8c1e26611f Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 4 Mar 2026 17:09:00 -0600 Subject: [PATCH] Fix broadcasting channel authorization --- routes/channels.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/routes/channels.php b/routes/channels.php index 80888cc8..a93e74c7 100644 --- a/routes/channels.php +++ b/routes/channels.php @@ -1,6 +1,7 @@ id === (int) $id; @@ -8,8 +9,13 @@ Broadcast::channel('App.Models.User.{id}', function ($user, $id) { Broadcast::channel('chat.{conversationId}', function ($user, $conversationId) { - return \App\Models\Conversation::where('id', $conversationId) + return Conversation::where('id', $conversationId) ->whereHas('users', fn ($q) => $q->where('user_id', $user->id) )->exists(); }); + + + + +Broadcast::channel('chat.{conversationId}', function ($user, $conversationId) {return Conversation::where('id', $conversationId)->whereHas('users', function ($q) use ($user) {$q->where('user_id', $user->id);})->exists();});