laravel - laravel 松弛消息未发送
问题描述
我遵循了一些关于如何通过 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');
}
解决方案
如果您使用 .env,请尝试清除缓存,如下所示:
php artisan cache:clear
推荐阅读
- html - 如何在输入字段的 vlaue 中加载 font-awesome 图标
- awk - 匹配模式后仅打印下一行的一部分
- azure - 将 azurerm_application_gateway 与 AKS 与 terraform 集成
- regex - 使用 GREP / Regex 将给定 url 扩展名的 url 中的下划线替换为破折号
- javascript - 如何检查字符串是否有星号后跟四位数字?
- python - Python 函数错误
- r - 将命名日期列表堆叠到 data.frame
- intellij-idea - Intellij 的问题:本地分支机构不显示
- ios - Swift:即使在压缩图像后将该图像写入文件夹后图像大小也在增加
- json - 无法将 Firebase 数据导出为 JSON。