vendredi 4 janvier 2019

Task Schedule Job withChain Laravel 5.6

I need to run a series of Jobs that run in sequence in Laravel at a scheduled interval (weekly) The withChain method works perfectly for this:

firstJob::withChain([
    new secondJob,
    new thirdJob
 ]);

When trying to run the chain within the Scheduler:

$schedule->job(firstJob::withChain([
    new secondJob,
    new thirdJob
 ]))->weekly();

I get the following error:

 In BoundMethod.php line 135:

 Method Illuminate\Foundation\Bus\PendingDispatch::handle() does not exist  

The output I get from the Scheduler in the cli is:

Running scheduled command: Illuminate\Foundation\Bus\PendingDispatch

So I understand that the job method isn't actually calling the job but the dispatch() method in the Dispatchable trait.

My question is how can I run chained Jobs within the Laravel Task Scheduler?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire