Skip to content

Commit 4a9b9aa

Browse files
committed
r laravel 7
1 parent 99dda70 commit 4a9b9aa

File tree

2 files changed

+19
-19
lines changed

2 files changed

+19
-19
lines changed

src/Integrations/BindsWorker.php

+19-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
use Dusterio\AwsWorker\Wrappers\DefaultWorker;
77
use Dusterio\AwsWorker\Wrappers\Laravel53Worker;
88
use Dusterio\AwsWorker\Wrappers\Laravel6Worker;
9+
use Illuminate\Contracts\Debug\ExceptionHandler;
10+
use Illuminate\Queue\Worker;
911

1012
/**
1113
* Class BindsWorker
@@ -18,7 +20,7 @@ trait BindsWorker
1820
*/
1921
protected $workerImplementations = [
2022
'5\.[345678]\.\d+' => Laravel53Worker::class,
21-
'6\.\d+\.\d+' => Laravel6Worker::class
23+
'[67]\.\d+\.\d+' => Laravel6Worker::class
2224
];
2325

2426
/**
@@ -39,6 +41,22 @@ protected function findWorkerClass($version)
3941
*/
4042
protected function bindWorker()
4143
{
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+
4260
$this->app->bind(WorkerInterface::class, $this->findWorkerClass($this->app->version()));
4361
}
4462
}

src/Integrations/LaravelServiceProvider.php

-18
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@
1010
use Illuminate\Support\Facades\Queue;
1111
use Illuminate\Queue\Events\JobProcessed;
1212
use Illuminate\Queue\QueueManager;
13-
use Illuminate\Queue\Worker;
14-
use Illuminate\Contracts\Debug\ExceptionHandler;
1513

1614
/**
1715
* Class CustomQueueServiceProvider
@@ -49,21 +47,5 @@ public function boot()
4947
$this->app->singleton(QueueManager::class, function() {
5048
return new QueueManager($this->app);
5149
});
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-
}
6850
}
6951
}

0 commit comments

Comments
 (0)