1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2026-02-05 09:24:02 +00:00

events dispatched

This commit is contained in:
Chinmay Purav 2024-09-12 23:37:23 +05:30
parent 7305c9e65b
commit 35f724128b

View file

@ -5,16 +5,22 @@ declare(strict_types=1);
namespace Stancl\Tenancy\Database\Concerns;
use Carbon\Carbon;
use Stancl\Tenancy\Events\TenantGoingInMaintenanceMode;
use Stancl\Tenancy\Events\TenantWentInMaintenanceMode;
trait MaintenanceMode
{
public function putDownForMaintenance($data = [])
{
event(new TenantGoingInMaintenanceMode($this));
$this->update(['maintenance_mode' => [
'time' => $data['time'] ?? Carbon::now()->getTimestamp(),
'message' => $data['message'] ?? null,
'retry' => $data['retry'] ?? null,
'allowed' => $data['allowed'] ?? [],
]]);
event(new TenantWentInMaintenanceMode($this));
}
}