I am an PHP/Laravel newbie. I am working with Laravel job new and everything works fine. However, when I have a look at the implementation of dispatch method, it looks weird to me.
if (! function_exists('dispatch')) {
/**
* Dispatch a job to its appropriate handler.
*
* @param mixed $job
* @return \Illuminate\Foundation\Bus\PendingDispatch
*/
function dispatch($job)
{
return new PendingDispatch($job);
}
}
I would expect some code that enqueues the job or at least triggers something to schedule the job to be executed later on. However, the method only creates an instance of PendingDispatch and returns it. I also checked the PendingDispatch constructor and found nothing relevant.
Could anyone please help me to understand how the job is scheduled?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire