阻止发送 Laravel 通知

Prevent a Laravel notification to be sent

我正在开发一项功能,用于发送 "cascade" 或 notifications 链,在不同频道之间有延迟。例如:

邮件 -> (30 分钟后) -> 推送 -> (30 分钟后) -> 短信

该流程运行良好,现在是用户完成某事或执行我希望链停止的操作。所以我停止或阻止发送通知。这是我尝试过的方法,但似乎没有任何效果 stop them

我试过:

public function via($notifiable)
{
    if (whatever condition to stop) {
        return null; // also tried with return []
    }

    return ['mail'];
}

还有

public function __construct(array $data = [])
{
    if (whatever condition to stop) {
        exit; // are you desperate, bruh?
    }
}

有什么我没有看到的非常明显的东西吗?可能与我们的自定义调度程序有关。 你知道我在哪里可以破坏应用程序以防止发送通知吗?

其实,这就够了:

public function via($notifiable)
{
    if (whatever condition to stop) {
        return [];
    }

    return ['mail'];
}

问题出在其他地方,Docker 向我展示了文件的缓存版本,所以他们总是返回 return ['mail'];