DispatchJobTask
Pushes a Job onto QueueManager rather than running it in-process — honors whatever queue driver the app has configured (sync or persistent).
Synopsis
Section titled “Synopsis”final readonly class DispatchJobTask implements ScheduledTaskAction
| Implements | ScheduledTaskAction |
| Source | DispatchJobTask.php |
Constructor
Section titled “Constructor”__construct()
Section titled “__construct()”public function __construct(class-string<Job> $jobClass, array<string, mixed> $params = []): mixed
| Parameter | Type | Description |
|---|---|---|
$jobClass | class-string``<Job> | |
$params | array``<``string``, ``mixed``> |
Returns mixed
Methods
Section titled “Methods”| Method | Description |
|---|---|
label(): string | Returns the job’s class name as the task’s label. |
run(Container $container): void | Pushes the configured job class and parameters onto the queue. |
label()
Section titled “label()”public function label(): string
Returns the job’s class name as the task’s label.
Returns string
public function run(Container $container): void
Pushes the configured job class and parameters onto the queue.
Resolves QueueManager from the container and enqueues the job rather than executing it here, so the app’s queue driver decides whether it runs now or later.
| Parameter | Type | Description |
|---|---|---|
$container | Container |