1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2025-12-13 21:04:03 +00:00

[2.x] Queued post-creation automigration (#154)

* Queued post-creation automigration

* Add shouldQueueMigration()

* Automigration test, config key, QueueTenancyBootstrapper support for QueueFake

* Apply fixes from StyleCI

* Fix if statement
This commit is contained in:
Samuel Štancl 2019-10-04 21:34:17 +02:00 committed by GitHub
parent b66574b1ab
commit abd0b8f04e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 88 additions and 6 deletions

View file

@ -5,6 +5,7 @@ declare(strict_types=1);
namespace Stancl\Tenancy\TenancyBootstrappers;
use Illuminate\Contracts\Foundation\Application;
use Illuminate\Support\Testing\Fakes\QueueFake;
use Stancl\Tenancy\Contracts\TenancyBootstrapper;
use Stancl\Tenancy\Tenant;
@ -21,9 +22,13 @@ class QueueTenancyBootstrapper implements TenancyBootstrapper
$this->app = $app;
$bootstrapper = &$this;
$this->app['queue']->createPayloadUsing(function () use (&$bootstrapper) {
return $bootstrapper->getPayload();
});
$queue = $this->app['queue'];
if (! $queue instanceof QueueFake) {
$queue->createPayloadUsing(function () use (&$bootstrapper) {
return $bootstrapper->getPayload();
});
}
}
public function start(Tenant $tenant)