1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2025-12-12 10:54:04 +00:00
tenancy/src/Commands/Up.php
Jori Stein 121370ea01
[4.x] Add command to bring the tenants up and down from maintenance and remove deprecated exception (#761)
* Add bring up from maintenance function

* Add up and down tenant maintenance commands

* Rename commands signatures

* Update TenancyServiceProvider.php

* Complying to Laravel maintenance code and parameters

* Update MaintenanceModeTest.php

* Add maintenance mode via commands test

* Update CheckTenantForMaintenanceMode.php

* Update MaintenanceModeTest.php

* Cookie bypass only for > Laravel 8

* minor formatting change, trigger CI

* clean

* Update MaintenanceModeTest.php

* Add comments for using the 'tenants' option in runForMultiple

* improve code

* php-cs-fixer

* fix php cs fixer config

* improve test logic

* remove version check since v4 will be L9+

Co-authored-by: Samuel Štancl <samuel@archte.ch>
Co-authored-by: lukinovec <lukinovec@gmail.com>
Co-authored-by: Samuel Štancl <samuel.stancl@gmail.com>
2022-09-29 15:59:14 +02:00

27 lines
621 B
PHP

<?php
declare(strict_types=1);
namespace Stancl\Tenancy\Commands;
use Illuminate\Console\Command;
use Stancl\Tenancy\Concerns\HasATenantsOption;
class Up extends Command
{
use HasATenantsOption;
protected $signature = 'tenants:up';
protected $description = 'Put tenants out of maintenance mode.';
public function handle(): void
{
tenancy()->runForMultiple($this->getTenants(), function ($tenant) {
$this->line("Tenant: {$tenant['id']}");
$tenant->bringUpFromMaintenance();
});
$this->comment('Tenants are now out of maintenance mode.');
}
}