1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2026-02-06 04:34:02 +00:00

Add maintenance mode events

This commit is contained in:
j.stein 2022-10-17 11:24:22 -04:00
parent 6ee93d0441
commit b855f257c4
5 changed files with 43 additions and 0 deletions

View file

@ -3,6 +3,8 @@
declare(strict_types=1);
namespace Stancl\Tenancy\Database\Concerns;
use Stancl\Tenancy\Events\TenantMaintenanceModeDisabled;
use Stancl\Tenancy\Events\TenantMaintenanceModeEnabled;
/**
* @mixin \Illuminate\Database\Eloquent\Model
@ -21,10 +23,14 @@ trait MaintenanceMode
'status' => $data['status'] ?? 503,
],
]);
event(new TenantMaintenanceModeEnabled($this));
}
public function bringUpFromMaintenance(): void
{
$this->update(['maintenance_mode' => null]);
event(new TenantMaintenanceModeDisabled($this));
}
}