【发布时间】:2018-09-12 09:13:33
【问题描述】:
我遵循了一些关于如何通过 Laravel 发送 Slack 消息的教程。 公共函数 routeNotificationForSlack($notification) 从未被调用,但我不知道为什么。
我的通知句柄如下所示,待办事项是通过以 ->get() 类结尾的雄辩查询检索到的:NotifyTodo :
foreach($todos as $todo) {
$reminder = new RemindTodo($todo);
$reminder->toSlack($reminder);
}
我的 toSlack 函数类:RemindTodo:
public function toSlack($notifiable)
{
$todo = $this->todo;
return (new SlackMessage)
->success()
->content($todo['description']);
}
还有我的 :Todo: 模型,其中包含使用 Notifiable;和 routeNotificationForSlack 方法:
public function routeNotificationForSlack($notification)
{
dd('test');
return env('SLACK_WEBHOOK_URL');
}
【问题讨论】:
标签: laravel notifications slack