diff --git a/app/Events/ChatMessageSent.php b/app/Events/ChatMessageSent.php index f823167b..75426384 100644 --- a/app/Events/ChatMessageSent.php +++ b/app/Events/ChatMessageSent.php @@ -34,8 +34,7 @@ class ChatMessageSent implements ShouldBroadcast */ public function broadcastOn() { - return new PrivateChannel('chat'. $this->message->channel_id); - + return new PrivateChannel('chat.' . $this->message->channel_id); } public function broadcastAs(): string diff --git a/routes/channels.php b/routes/channels.php index f1bca13e..fbcd48df 100644 --- a/routes/channels.php +++ b/routes/channels.php @@ -19,6 +19,6 @@ Broadcast::channel('App.Models.User.{id}', function ($user, $id) { return (int) $user->id === (int) $id; }); -Broadcast::channel('chat{room_id}', function ($user, $room_id) { +Broadcast::channel('chat.{room_id}', function ($user, $room_id) { return Auth::check(); });