Laravel 5.5 On demand notification with slack

耗尽温柔 提交于 2019-12-23 10:33:51

问题


According to this page, we can send a notification on demand without going through a model. How do I do the same using slack?

I want to do something like this:

$emailAddress = 'my email address';
Notification::route('mail', $emailAddress)
            ->route('slack', 'what do I put here?')
            ->notify(new TestNotification());

The code works without the slack line.

Edit: this StackOverflow question uses the on demand method


回答1:


You should you put the Slack Webhook URL. See: https://laravel.com/docs/5.5/notifications#routing-slack-notifications

 Notification::route('slack', 'https://hooks.slack.com/services/ZZZZ/YYYY/XXX')->notify(new DailyStats());


来源:https://stackoverflow.com/questions/48278174/laravel-5-5-on-demand-notification-with-slack

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!