I used laravel 5.1 Queue for my background function with async. But i want to run that function for only 1 time. If that function fail, i want to do other process. How can i detect my job is failed or not? Am i doing right or wrong ? What should i change? ps: I'm beginner. I used like this in my controller.
$job = new myjob($var1, $var2);
$this->dispatch($job);
$job->release();
if ($job->attempts() >= 1)
{
$job->delete();
//will do other process
}