From c55694ec8c8c611ca5ddadfc76b5d14a53d6a834 Mon Sep 17 00:00:00 2001 From: Mekan1206 Date: Sat, 15 Aug 2026 21:01:10 +0500 Subject: [PATCH] WIP --- routes/channels.php | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/routes/channels.php b/routes/channels.php index 265099e..79e19cd 100644 --- a/routes/channels.php +++ b/routes/channels.php @@ -15,7 +15,17 @@ use Illuminate\Support\Facades\DB; | */ +Broadcast::channel('chat.support', function ($user) { + return ChatSupport::isOperator($user); +}); + Broadcast::channel('chat.{conversationId}', function ($user, $conversationId) { + if (! ctype_digit((string) $conversationId)) { + return false; + } + + $conversationId = (int) $conversationId; + $isParticipant = DB::table('conversation_user') ->where('conversation_id', $conversationId) ->where('user_id', $user->id) @@ -26,9 +36,5 @@ Broadcast::channel('chat.{conversationId}', function ($user, $conversationId) { } return ChatSupport::isOperator($user) - && ChatSupport::conversationIncludesSupport((int) $conversationId); -}); - -Broadcast::channel('chat.support', function ($user) { - return ChatSupport::isOperator($user); + && ChatSupport::conversationIncludesSupport($conversationId); });