How to manage successful or failed task in Laravel

Categorized as Laravel Tagged

You can run specific code if your schedule succeeds or fails with this simple code:

$schedule->command('emails:send')
  ->daily()
  ->onSuccess(function () {
      // The task succeeded
  })
  ->onFailure(function () {
      // The task failed 
  });

Leave a reply

Your email address will not be published. Required fields are marked *