File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed
src/Illuminate/Foundation/Bus Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change 2
2
3
3
namespace Illuminate \Foundation \Bus ;
4
4
5
+ use Closure ;
6
+ use Illuminate \Queue \CallQueuedClosure ;
7
+ use Illuminate \Queue \SerializableClosure ;
8
+
5
9
class PendingChain
6
10
{
7
11
/**
@@ -38,9 +42,13 @@ public function __construct($job, $chain)
38
42
*/
39
43
public function dispatch ()
40
44
{
41
- $ firstJob = is_string ($ this ->job )
42
- ? new $ this ->job (...func_get_args ())
43
- : $ this ->job ;
45
+ if (is_string ($ this ->job )) {
46
+ $ firstJob = new $ this ->job (...func_get_args ());
47
+ } elseif ($ this ->job instanceof Closure) {
48
+ $ firstJob = new CallQueuedClosure (new SerializableClosure ($ this ->job ));
49
+ } else {
50
+ $ firstJob = $ this ->job ;
51
+ }
44
52
45
53
return (new PendingDispatch ($ firstJob ))->chain ($ this ->chain );
46
54
}
You can’t perform that action at this time.
0 commit comments