From 40eaa23d653c7b7cc2ff04a9f868a8fa8a95e1f0 Mon Sep 17 00:00:00 2001 From: iamgergo Date: Thu, 19 Nov 2020 16:14:40 +0100 Subject: [PATCH 1/2] [8.x] Add docs for per channel delay --- notifications.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/notifications.md b/notifications.md index 9d0a507e27..63d1d41734 100644 --- a/notifications.md +++ b/notifications.md @@ -148,6 +148,15 @@ If you would like to delay the delivery of the notification, you may chain the ` $user->notify((new InvoicePaid($invoice))->delay($when)); +You may pass an array to the `delay` method to specify the delay of the given channels: + + $when = now()->addMinutes(10); + + $user->notify((new InvoicePaid($invoice))->delay([ + 'sms' => $when, + 'mail' => $when->addDay(), + ])); + #### Customizing Notification Channel Queues From f5ab834875194f90c7dac131bef751a7108c5c0a Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Thu, 19 Nov 2020 09:33:48 -0600 Subject: [PATCH 2/2] Update notifications.md --- notifications.md | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/notifications.md b/notifications.md index 63d1d41734..6d51ce676c 100644 --- a/notifications.md +++ b/notifications.md @@ -144,17 +144,15 @@ Once the `ShouldQueue` interface has been added to your notification, you may se If you would like to delay the delivery of the notification, you may chain the `delay` method onto your notification instantiation: - $when = now()->addMinutes(10); + $delay = now()->addMinutes(10); - $user->notify((new InvoicePaid($invoice))->delay($when)); + $user->notify((new InvoicePaid($invoice))->delay($delay)); -You may pass an array to the `delay` method to specify the delay of the given channels: - - $when = now()->addMinutes(10); +You may pass an array to the `delay` method to specify the delay amount for specific channels: $user->notify((new InvoicePaid($invoice))->delay([ - 'sms' => $when, - 'mail' => $when->addDay(), + 'mail' => now()->addMinutes(5), + 'sms' => now()->addMinutes(10), ]));