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

Glimpse streamlines Laravel development by seamlessly deploying GitHub pull requests to preview environments with the help of Laravel Forge. Glimpse streamlines Laravel development by seamlessly deploying GitHub pull requests to preview environments with the help of Laravel Forge.
Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Shirts painstakingly handcrafted by under-caffeinated developers. Shirts painstakingly handcrafted by under-caffeinated developers.
Community Partners