mirror of
https://github.com/archtechx/tenancy.git
synced 2026-02-05 16:14:03 +00:00
Better dependency injection
This commit is contained in:
parent
2641fae3a3
commit
2def3b20dd
1 changed files with 7 additions and 7 deletions
|
|
@ -4,7 +4,8 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace Stancl\Tenancy\TenancyBootstrappers;
|
namespace Stancl\Tenancy\TenancyBootstrappers;
|
||||||
|
|
||||||
use Illuminate\Contracts\Foundation\Application;
|
use Illuminate\Config\Repository;
|
||||||
|
use Illuminate\Queue\QueueManager;
|
||||||
use Illuminate\Support\Testing\Fakes\QueueFake;
|
use Illuminate\Support\Testing\Fakes\QueueFake;
|
||||||
use Stancl\Tenancy\Contracts\TenancyBootstrapper;
|
use Stancl\Tenancy\Contracts\TenancyBootstrapper;
|
||||||
use Stancl\Tenancy\Tenant;
|
use Stancl\Tenancy\Tenant;
|
||||||
|
|
@ -14,16 +15,15 @@ class QueueTenancyBootstrapper implements TenancyBootstrapper
|
||||||
/** @var bool Has tenancy been started. */
|
/** @var bool Has tenancy been started. */
|
||||||
public $started = false;
|
public $started = false;
|
||||||
|
|
||||||
/** @var Application */
|
/** @var Repository */
|
||||||
protected $app;
|
protected $config;
|
||||||
|
|
||||||
public function __construct(Application $app)
|
public function __construct(Repository $config, QueueManager $queue)
|
||||||
{
|
{
|
||||||
$this->app = $app;
|
$this->config = $config;
|
||||||
|
|
||||||
$bootstrapper = &$this;
|
$bootstrapper = &$this;
|
||||||
|
|
||||||
$queue = $this->app['queue'];
|
|
||||||
if (! $queue instanceof QueueFake) {
|
if (! $queue instanceof QueueFake) {
|
||||||
$queue->createPayloadUsing(function ($connection) use (&$bootstrapper) {
|
$queue->createPayloadUsing(function ($connection) use (&$bootstrapper) {
|
||||||
return $bootstrapper->getPayload($connection);
|
return $bootstrapper->getPayload($connection);
|
||||||
|
|
@ -47,7 +47,7 @@ class QueueTenancyBootstrapper implements TenancyBootstrapper
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->app['config']["queue.connections.$connection.tenancy"] === false) {
|
if ($this->config["queue.connections.$connection.tenancy"] === false) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue