Q:

How can i run Laravel Queue only once?

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
}

A:

You should use --tries parameter with 1 value, for example:
php artisan queue:work --tries=1

This will run each task only once and won't repeat it in case of failure.

