mirror of
https://github.com/archtechx/tenancy.git
synced 2025-12-12 22:34:03 +00:00
Automatic mode
This commit is contained in:
parent
2492345280
commit
73fc525126
16 changed files with 154 additions and 40 deletions
|
|
@ -0,0 +1,15 @@
|
|||
<?php
|
||||
|
||||
namespace Stancl\Tenancy\Events\Listeners;
|
||||
|
||||
use Stancl\Tenancy\Events\TenancyInitialized;
|
||||
|
||||
class BootstrapTenancy
|
||||
{
|
||||
public function handle(TenancyInitialized $event)
|
||||
{
|
||||
foreach ($event->tenancy->getBootstrappers() as $bootstrapper) {
|
||||
$bootstrapper->start($event->tenancy->tenant);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -4,12 +4,12 @@ namespace Stancl\Tenancy\Events\Listeners;
|
|||
|
||||
use Stancl\Tenancy\Events\TenancyEnded;
|
||||
|
||||
class RevertToCentral
|
||||
class RevertToCentralContext
|
||||
{
|
||||
public function handle(TenancyEnded $event)
|
||||
{
|
||||
foreach (tenancy()->getBootstrappers() as $bootstrapper) {
|
||||
foreach ($event->tenancy->getBootstrappers() as $bootstrapper) {
|
||||
$bootstrapper->end();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2,15 +2,15 @@
|
|||
|
||||
namespace Stancl\Tenancy\Events;
|
||||
|
||||
use Stancl\Tenancy\Database\Models\Tenant;
|
||||
use Stancl\Tenancy\Tenancy;
|
||||
|
||||
class TenancyEnded
|
||||
{
|
||||
/** @var Tenant */
|
||||
protected $tenant;
|
||||
/** @var Tenancy */
|
||||
public $tenancy;
|
||||
|
||||
public function __construct(Tenant $tenant)
|
||||
public function __construct(Tenancy $tenancy)
|
||||
{
|
||||
$this->tenant = $tenant;
|
||||
$this->tenancy = $tenancy;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,15 +2,15 @@
|
|||
|
||||
namespace Stancl\Tenancy\Events;
|
||||
|
||||
use Stancl\Tenancy\Database\Models\Tenant;
|
||||
use Stancl\Tenancy\Tenancy;
|
||||
|
||||
class TenancyInitialized
|
||||
{
|
||||
/** @var Tenant */
|
||||
protected $tenant;
|
||||
/** @var Tenancy */
|
||||
public $tenancy;
|
||||
|
||||
public function __construct(Tenant $tenant)
|
||||
public function __construct(Tenancy $tenancy)
|
||||
{
|
||||
$this->tenant = $tenant;
|
||||
$this->tenancy = $tenancy;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue