middleware([InitializeTenancyByDomain::class, CheckTenantForMaintenanceMode::class]); $tenant = MaintenanceTenant::create(); $tenant->domains()->create([ 'domain' => 'acme.localhost', ]); $this->get('http://acme.localhost/foo') ->assertSuccessful(); tenancy()->end(); // flush stored tenant instance $tenant->putDownForMaintenance(); $this->get('http://acme.localhost/foo') ->assertStatus(503); tenancy()->end(); $tenant->bringUpFromMaintenance(); tenancy()->end(); $this->get('http://acme.localhost/foo') ->assertSuccessful() ->assertSeeText('bar'); } /** @test */ public function tenant_can_be_in_maintenance_mode_from_command() { } } class MaintenanceTenant extends Tenant { use MaintenanceMode; }