From f96e19d3e9470b63ea191cf2f5a6f278bd2a81f3 Mon Sep 17 00:00:00 2001 From: Sedat BOZKURT Date: Fri, 11 Oct 2019 17:31:21 +0300 Subject: [PATCH] receivesBroadcastNotificationsOn can return array for multiple channels of user --- .../Events/BroadcastNotificationCreated.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/Illuminate/Notifications/Events/BroadcastNotificationCreated.php b/src/Illuminate/Notifications/Events/BroadcastNotificationCreated.php index 7c5780c42f4e..c94642b6cf64 100644 --- a/src/Illuminate/Notifications/Events/BroadcastNotificationCreated.php +++ b/src/Illuminate/Notifications/Events/BroadcastNotificationCreated.php @@ -60,13 +60,23 @@ public function broadcastOn() return $channels; } - return [new PrivateChannel($this->channelName())]; + $channelNames = $this->channelName(); + if (is_string($channelNames)) { + return [new PrivateChannel($channelNames)]; + } + + $channels = []; + foreach ($channelNames as $channel) { + $channels[] = new PrivateChannel($channel); + } + + return $channels; } /** * Get the broadcast channel name for the event. * - * @return string + * @return string|array */ protected function channelName() {