File tree 2 files changed +19
-19
lines changed
2 files changed +19
-19
lines changed Original file line number Diff line number Diff line change 6
6
use Dusterio \AwsWorker \Wrappers \DefaultWorker ;
7
7
use Dusterio \AwsWorker \Wrappers \Laravel53Worker ;
8
8
use Dusterio \AwsWorker \Wrappers \Laravel6Worker ;
9
+ use Illuminate \Contracts \Debug \ExceptionHandler ;
10
+ use Illuminate \Queue \Worker ;
9
11
10
12
/**
11
13
* Class BindsWorker
@@ -18,7 +20,7 @@ trait BindsWorker
18
20
*/
19
21
protected $ workerImplementations = [
20
22
'5\.[345678]\.\d+ ' => Laravel53Worker::class,
21
- '6 \.\d+\.\d+ ' => Laravel6Worker::class
23
+ '[67] \.\d+\.\d+ ' => Laravel6Worker::class
22
24
];
23
25
24
26
/**
@@ -39,6 +41,22 @@ protected function findWorkerClass($version)
39
41
*/
40
42
protected function bindWorker ()
41
43
{
44
+ // If Laravel version is 6 or above then the worker bindings change. So we initiate it here
45
+ if ($ this ->app ->version () >= 6 ) {
46
+ $ this ->app ->singleton (Worker::class, function () {
47
+ $ isDownForMaintenance = function () {
48
+ return $ this ->app ->isDownForMaintenance ();
49
+ };
50
+
51
+ return new Worker (
52
+ $ this ->app ['queue ' ],
53
+ $ this ->app ['events ' ],
54
+ $ this ->app [ExceptionHandler::class],
55
+ $ isDownForMaintenance
56
+ );
57
+ });
58
+ }
59
+
42
60
$ this ->app ->bind (WorkerInterface::class, $ this ->findWorkerClass ($ this ->app ->version ()));
43
61
}
44
62
}
Original file line number Diff line number Diff line change 10
10
use Illuminate \Support \Facades \Queue ;
11
11
use Illuminate \Queue \Events \JobProcessed ;
12
12
use Illuminate \Queue \QueueManager ;
13
- use Illuminate \Queue \Worker ;
14
- use Illuminate \Contracts \Debug \ExceptionHandler ;
15
13
16
14
/**
17
15
* Class CustomQueueServiceProvider
@@ -49,21 +47,5 @@ public function boot()
49
47
$ this ->app ->singleton (QueueManager::class, function () {
50
48
return new QueueManager ($ this ->app );
51
49
});
52
-
53
- // If laravel version is 6 or above then the worker bindings change. So we initiate it here
54
- if ($ this ->app ->version () >= 6 ) {
55
- $ this ->app ->singleton (Worker::class, function () {
56
- $ isDownForMaintenance = function () {
57
- return $ this ->app ->isDownForMaintenance ();
58
- };
59
-
60
- return new Worker (
61
- $ this ->app ['queue ' ],
62
- $ this ->app ['events ' ],
63
- $ this ->app [ExceptionHandler::class],
64
- $ isDownForMaintenance
65
- );
66
- });
67
- }
68
50
}
69
51
}
You can’t perform that action at this time.
0 commit comments