jeudi 4 avril 2019

Dispatching a Laravel job in scheduler, pre-5.5

I'm used to Laravel 5.5+ where you can call $schedule->job(new ExampleJob); to fire jobs, which is not available in 5.4. I'm attempting to do something like this:

$schedule->call(function () {
    dispatch(new AppointmentReminder);
})->dailyAt('08:00');

but the job is not firing. I've verified that this is being called at the correct time. I'm guessing the dispatch() method is not available in App\Console\Kernal.php? Does anyone know of the official way of dispatching jobs in 5.4's scheduler? This is a legacy code base and all of the jobs are inline in the Kernal.php which is a total mess. Not to mention this is a rather involved job.

I did try use Illuminate\Foundation\Bus\DispatchesJobs; in Kernal.php, but that did not seem to do the trick. Thanks!



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire