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();});