mirror of
https://github.com/archtechx/tenancy.git
synced 2026-02-05 15:14:04 +00:00
Add maintenance events
This commit is contained in:
parent
df70463331
commit
d52254eb94
4 changed files with 26 additions and 0 deletions
|
|
@ -58,6 +58,8 @@ class TenancyServiceProvider extends ServiceProvider
|
|||
return $event->tenant;
|
||||
})->shouldBeQueued(false), // `false` by default, but you probably want to make this `true` for production.
|
||||
],
|
||||
Events\TenantMaintenanceModeEnabled::class => [],
|
||||
Events\TenantMaintenanceModeDisabled::class => [],
|
||||
|
||||
// Domain events
|
||||
Events\CreatingDomain::class => [],
|
||||
|
|
|
|||
|
|
@ -5,6 +5,8 @@ declare(strict_types=1);
|
|||
namespace Stancl\Tenancy\Database\Concerns;
|
||||
|
||||
use Illuminate\Contracts\Container\BindingResolutionException;
|
||||
use Stancl\Tenancy\Events\TenantMaintenanceModeDisabled;
|
||||
use Stancl\Tenancy\Events\TenantMaintenanceModeEnabled;
|
||||
use Stancl\Tenancy\Maintenance\TenantMaintenanceModeContract;
|
||||
|
||||
/**
|
||||
|
|
@ -33,6 +35,8 @@ trait MaintenanceMode
|
|||
public function putDownForMaintenance(array $payload = []): void
|
||||
{
|
||||
$this->maintenanceMode()->activate($payload);
|
||||
|
||||
event(new TenantMaintenanceModeEnabled($this));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -44,6 +48,8 @@ trait MaintenanceMode
|
|||
public function bringUpFromMaintenance(): void
|
||||
{
|
||||
$this->maintenanceMode()->deactivate();
|
||||
|
||||
event(new TenantMaintenanceModeDisabled($this));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
9
src/Events/TenantMaintenanceModeDisabled.php
Normal file
9
src/Events/TenantMaintenanceModeDisabled.php
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Stancl\Tenancy\Events;
|
||||
|
||||
class TenantMaintenanceModeDisabled extends Contracts\TenantEvent
|
||||
{
|
||||
}
|
||||
9
src/Events/TenantMaintenanceModeEnabled.php
Normal file
9
src/Events/TenantMaintenanceModeEnabled.php
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Stancl\Tenancy\Events;
|
||||
|
||||
class TenantMaintenanceModeEnabled extends Contracts\TenantEvent
|
||||
{
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue