限制从 Laravel Notification facade 发送到 Slack 的消息

Limit messages sent to Slack from Laravel Notification facade

在我的应用程序中,我在发生某些事情时使用通知。

Notification::send($users, new ThingStarted($thing));

效果很好。它会向每个用户发送一条短信和一封电子邮件,还会向 Slack 频道发送一条消息(因为您永远不会收到太多通知,对吧?)。这里的主要问题是,对于多个用户,有几条消息发送到 Slack 频道,而不仅仅是一条。

我知道我可以创建一个额外的通知,但里面的信息是一样的,所以另一个似乎是多余的。

我可以停止为每个用户触发 toSlack() 方法吗?

我想多了

我可以

Notification::send($users, new ThingStarted($thing));
Notification::send($group, new ThingStarted($thing));

然后删除 User 模型上的 routeNotificationForSlack