gpt4 book ai didi

php - 阻止发送 Laravel 通知

转载 作者:行者123 更新时间:2023-12-05 02:08:34 26 4
gpt4 key购买 nike

我正在研究一项发送“级联”或 notifications 链的功能它们之间有不同 channel 的延迟。例如:

邮件->(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'];

关于php - 阻止发送 Laravel 通知,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60760231/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com