You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jul 16, 2021. It is now read-only.
There are many scenarios where it is useful to check for certain conditions before sending a queued notification.
For example, imagine a user marking an order as "dispatched", which queues an OrderDispatched notification. If the order was marked as dispatched by mistake, there's currently no easy way to prevent the notification being sent to the appropriate channels.
There are two workarounds I know of: a) queue a Job instead, performing checks inside handle() and then dispatch the notification synchronously, or b) create a method on the notification, listen for NotificationSending events, and check for the existence of the method on the notification before it is sent.
My suggestion would be to add a new shouldBeSent($channel, $notifiable) method which would be called inside the Illuminate\Notifications\NotificationSender::shouldSendNotification() method. This allows us to add easily add custom logic for cancelling notifictions when data has changed since dispatch, without having to define a custom listener.
The text was updated successfully, but these errors were encountered:
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
There are many scenarios where it is useful to check for certain conditions before sending a queued notification.
For example, imagine a user marking an order as "dispatched", which queues an
OrderDispatched
notification. If the order was marked as dispatched by mistake, there's currently no easy way to prevent the notification being sent to the appropriate channels.There are two workarounds I know of: a) queue a Job instead, performing checks inside
handle()
and then dispatch the notification synchronously, or b) create a method on the notification, listen forNotificationSending
events, and check for the existence of the method on the notification before it is sent.My suggestion would be to add a new
shouldBeSent($channel, $notifiable)
method which would be called inside theIlluminate\Notifications\NotificationSender::shouldSendNotification()
method. This allows us to add easily add custom logic for cancelling notifictions when data has changed since dispatch, without having to define a custom listener.The text was updated successfully, but these errors were encountered: