November 20, 2016 —John Koster
dispatch($command)
The dispatch
helper function can be used to push a new job onto the job queue (or dispatch the job). The function resolves the configured Illuminate\Contracts\Bus\Dispatcher
implementation from the Service Container and then calls the dispatch
method in the Dispatcher
instance.
Assuming a variable $job
exists that contains a valid queueable Job
the following examples are all equivalent:
1<?php2 3use Illuminate\Contracts\Bus\Dispatcher;4use Illuminate\Support\Facades\Bus;5 6dispatch($job);7app(Dispatcher::class)->dispatch($job);8Bus::dispatch($job);
∎
The following amazing people help support this site and my open source projects ♥️
If you're interesting in supporting my work and want to show up on this list, check out my GitHub Sponsors Profile.