mirror of
https://github.com/archtechx/tenancy.git
synced 2026-02-06 08:04:03 +00:00
Merge branch 'master' into stein-j-readied-tenant
This commit is contained in:
commit
0d1a85005d
19 changed files with 180 additions and 52 deletions
|
|
@ -4,17 +4,27 @@ declare(strict_types=1);
|
|||
|
||||
namespace Stancl\Tenancy\Database\Concerns;
|
||||
|
||||
use Carbon\Carbon;
|
||||
|
||||
/**
|
||||
* @mixin \Illuminate\Database\Eloquent\Model
|
||||
*/
|
||||
trait MaintenanceMode
|
||||
{
|
||||
public function putDownForMaintenance($data = [])
|
||||
public function putDownForMaintenance($data = []): void
|
||||
{
|
||||
$this->update(['maintenance_mode' => [
|
||||
'time' => $data['time'] ?? Carbon::now()->getTimestamp(),
|
||||
'message' => $data['message'] ?? null,
|
||||
'retry' => $data['retry'] ?? null,
|
||||
'allowed' => $data['allowed'] ?? [],
|
||||
]]);
|
||||
$this->update([
|
||||
'maintenance_mode' => [
|
||||
'except' => $data['except'] ?? null,
|
||||
'redirect' => $data['redirect'] ?? null,
|
||||
'retry' => $data['retry'] ?? null,
|
||||
'refresh' => $data['refresh'] ?? null,
|
||||
'secret' => $data['secret'] ?? null,
|
||||
'status' => $data['status'] ?? 503,
|
||||
],
|
||||
]);
|
||||
}
|
||||
|
||||
public function bringUpFromMaintenance(): void
|
||||
{
|
||||
$this->update(['maintenance_mode' => null]);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue