1
0
Fork 0
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:
Samuel Štancl 2022-09-29 16:01:24 +02:00 committed by GitHub
commit 0d1a85005d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 180 additions and 52 deletions

View file

@ -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]);
}
}