0
votes

I followed a few tutorials on how to send a Slack message through Laravel. The public function routeNotificationForSlack($notification) is never called, but I dont know why.

My Notification handle looks like this, the todos are retrieved by a eloquent query ending with ->get() class: NotifyTodo :

foreach($todos as $todo) {

    $reminder = new RemindTodo($todo);

    $reminder->toSlack($reminder);
}

My toSlack function class :RemindTodo:

public function toSlack($notifiable)
{
    $todo = $this->todo;

    return (new SlackMessage)
        ->success()
        ->content($todo['description']);
}

And my :Todo: model which contains the use Notifiable; and the routeNotificationForSlack method:

public function routeNotificationForSlack($notification)
{
    dd('test');
    return env('SLACK_WEBHOOK_URL');
}
1

1 Answers

0
votes

Try clear the cache if you are using .env as below:

php artisan cache:clear