From 18d26df24f1f3b17bd20c7244d9b85d273138d79 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Mon, 24 Oct 2016 09:55:44 -0500 Subject: [PATCH] Fix UUIDs when queueing. --- src/Illuminate/Notifications/ChannelManager.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/Illuminate/Notifications/ChannelManager.php b/src/Illuminate/Notifications/ChannelManager.php index 11685d4e99a4..33b622d3e72c 100644 --- a/src/Illuminate/Notifications/ChannelManager.php +++ b/src/Illuminate/Notifications/ChannelManager.php @@ -68,7 +68,9 @@ public function sendNow($notifiables, $notification, array $channels = null) foreach ($channels as $channel) { $notification = clone $original; - $notification->id = $notificationId; + if (! $notification->id) { + $notification->id = $notificationId; + } if (! $this->shouldSendNotification($notifiable, $notification, $channel)) { continue; @@ -111,8 +113,16 @@ protected function queueNotification($notifiables, $notification) $bus = $this->app->make(Bus::class); + $original = clone $notification; + foreach ($notifiables as $notifiable) { + $notificationId = (string) Uuid::uuid4(); + foreach ($notification->via($notifiable) as $channel) { + $notification = clone $original; + + $notification->id = $notificationId; + $bus->dispatch( (new SendQueuedNotifications($this->formatNotifiables($notifiable), $notification, [$channel])) ->onConnection($notification->connection)