jeudi 3 août 2017

Laravel Queue - remembering property state?

If a job failed, it will be pushed back to the Queue. Is there a way to remember the value of property in the job class when processing job again?

For example:

class MailJob extends Job
{
    public $tries = 3;

    public $status;


    public function __construct()
    {
        $this->status = false; // set to false
    }


    /**
     * Execute the job.
     */
    public function handle()
    {
        $this->status = true;
        // Assume job has failed, it went back to the Queue.
        // status should be true when this job start processing again
    }
}



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2vwfVOV
via IFTTT

Aucun commentaire:

Enregistrer un commentaire