Reputation: 1235
I'm working on a feature to send a "cascade" or a chain of notifications with a delay between them with different channel. For example:
Email -> (30 minutes later) -> Push -> (30 minutes later) -> SMS
That flow is working good, now is the user completes something or does an action I want the chain to stop. So I stop or prevent the notification to be sent. This is what I've tried, but nothing seems to stop them.
I've tried:
public function via($notifiable)
{
if (whatever condition to stop) {
return null; // also tried with return []
}
return ['mail'];
}
Also
public function __construct(array $data = [])
{
if (whatever condition to stop) {
exit; // are you desperate, bruh?
}
}
Is there something super obvious I'm not seeing? Might be related to our custom scheduler, tho. Do you have an idea where can I break the app to prevent the notification to be sent?
Upvotes: 3
Views: 3247
Reputation: 1235
Actually, this was enough:
public function via($notifiable)
{
if (whatever condition to stop) {
return [];
}
return ['mail'];
}
The problem was something else, Docker was showing me a cached version of the files, so they were always returning a return ['mail'];
Upvotes: 8