Category: Laravel, api

Laravel Jobs allow you to queue up processes to be done at a later date, this is normally reserved for longer running tasks or tasks that need to communicate with a third party. As Jobs run in the background on a queue there is no instant response to when and how they failed, therefore we need to find a way of alerting you to the failed jobs and why they failed.

If you want to handle the failure of jobs differently per job you can add a failed method to your job class.

From this failed event we're going to use the Laravel Notifications class to send the alert to the slack channel.

There is a nice interface in Laravel to sending Slack messages, we will use this to construct the slack message and attach the exception to the message.
Newsletter

Get the latest Laravel/PHP jobs, events and curated articles straight to your inbox, once a week

Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future. Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future.
Community Partners