Skip to content

Commit f79b684

Browse files
authored
[8.x] Include dispatchSync in the DispatchesJobs trait (#37063)
* Update DispatchesJobs.php Include new dispatchSync * Update DispatchesJobs.php * add deprecation notice
1 parent c607db9 commit f79b684

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/Illuminate/Foundation/Bus/DispatchesJobs.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,24 @@ protected function dispatch($job)
2222
*
2323
* @param mixed $job
2424
* @return mixed
25+
*
26+
* @deprecated Will be removed in a future Laravel version.
2527
*/
2628
public function dispatchNow($job)
2729
{
2830
return app(Dispatcher::class)->dispatchNow($job);
2931
}
32+
33+
/**
34+
* Dispatch a command to its appropriate handler in the current process.
35+
*
36+
* Queueable jobs will be dispatched to the "sync" queue.
37+
*
38+
* @param mixed $job
39+
* @return mixed
40+
*/
41+
public function dispatchSync($job)
42+
{
43+
return app(Dispatcher::class)->dispatchSync($job);
44+
}
3045
}

0 commit comments

Comments
 (0)