Skip to content

Conversation

@techmahedy
Copy link
Member

New Dispatch Methods
Using the dispatch method for a chainable way to dispatch a queue job:

(new SendEmailJob([
    'to' => 'user@example.com',
    'subject' => 'Welcome!',
    'message' => 'Thanks for signing up!',
]))->dispatch();

Others example

(new ProcessImageJob($imageData))
    ->onQueue('images')
    ->delayFor(300)
    ->dispatch();

SendEmailJob::dispatchNow([
    'to' => 'admin@example.com',
    'subject' => 'Alert',
    'message' => 'System notification',
]);

(new ProcessImageJob($imageData))->dispatchOn('images');

(new SendEmailJob($emailData))->dispatchAfter(300); // 5 minutes

The previous way will remain the same

$job = new SendEmailJob($emailData);
Queue::push($job);

@techmahedy techmahedy added the enhancement New feature or request label Nov 14, 2025
@techmahedy techmahedy merged commit d14ee72 into master Nov 14, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants