First the event did not fire. My code was
event( new SignUpEmailOrganiser($santa, $eventObj, $santaConfirmationObj) );
I did try to use Event::fire but that didn’t work either. having spent some time on the front-end, it was time to look at the Laravel 5.3 documentation, it seems that i was passing an email method into the event function. I am not sure why it worked previously but the event function takes an event object
event( new SantaSignUp($santa, $eventObj, $santaConfirmationObj) );
At some point I also received an error with the jobs table regarding a value passed to the ‘attempts’ column being out of range which was strange. But it seems after this the error did not turn up again instead what happened was the app was still using an old cached file that was pointing to the incorrect location of the email blade file.
php artisan cache:clear
Clearing the application cache immediately fixed this.
The fastest way to debug a queue is to check the laravel log. It can be found under the /storage/logs directory. Here it prints the stack trace making it very clear what the error is and you’re able to follow the point where the errors occurred. Use it.
Re-testing a failed job
Whatever the process is to trigger the event. You don’t want to have to sign up forms every time you want the event triggered, if you want to test the queue. If you want to test the event you may have to sign up but to easily re-qeuue a job that was failed, you can use the following commands
First find the relevant job in the jobs table with
php artisan queue:failed
Locate the ID number and use that as the argument for the command
php artisan queue:retry