From c5111ec00ec0d4d0aa5ea472b65c7e177d1aabe9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20=C5=A0tancl?= Date: Sat, 1 Aug 2020 20:25:00 +0200 Subject: [PATCH] maintenance mode --- navigation.php | 1 + .../docs/v3/tenant-maintenance-mode.blade.md | 29 +++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 source/docs/v3/tenant-maintenance-mode.blade.md diff --git a/navigation.php b/navigation.php index 147521c..0242bfb 100644 --- a/navigation.php +++ b/navigation.php @@ -210,6 +210,7 @@ return [ 'Console commands' => 'console-commands', 'Cached lookup' => 'cached-lookup', 'Real-time facades' => 'realtime-facades', + 'Tenant maintenance mode' => 'tenant-maintenance-facades', ], ], ], diff --git a/source/docs/v3/tenant-maintenance-mode.blade.md b/source/docs/v3/tenant-maintenance-mode.blade.md new file mode 100644 index 0000000..ddf081d --- /dev/null +++ b/source/docs/v3/tenant-maintenance-mode.blade.md @@ -0,0 +1,29 @@ +--- +title: Tenant maintenance mode +extends: _layouts.documentation +section: content +--- + +# Tenant maintenance mode {#tenant-maintenance-mode} + +You may put specific tenants into maintenance mode using the `MaintenanceMode` trait. + +Apply it on your [Tenant model]({{ $page->link('tenants') }}): + +```php +use Stancl\Tenancy\Database\Concerns\MaintenanceMode; + +class Tenant extends BaseTenant +{ + use MaintenanceMode; +} +``` + +This will let you use the following method on each tenant object: +```php +$tenant->putDownForMaintenance(); +``` + +## Middleware {#middleware} + +You will also need to use the `Stancl\Tenancy\Middleware\CheckTenantForMaintenanceMode` middleware on your tenant routes.