问题
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