From 0a2bbc5a168affc60d80b899693bca6ca5b8a568 Mon Sep 17 00:00:00 2001 From: lukinovec Date: Tue, 2 Aug 2022 08:17:30 +0200 Subject: [PATCH] Add comments for using the 'tenants' option in runForMultiple --- src/Commands/Down.php | 4 ++-- src/Commands/Up.php | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Commands/Down.php b/src/Commands/Down.php index be5ea707..6b01d149 100644 --- a/src/Commands/Down.php +++ b/src/Commands/Down.php @@ -4,10 +4,8 @@ declare(strict_types=1); namespace Stancl\Tenancy\Commands; -use Illuminate\Console\Command; use Illuminate\Foundation\Console\DownCommand; use Stancl\Tenancy\Concerns\HasATenantsOption; -use Symfony\Component\Console\Input\InputOption; class Down extends DownCommand { @@ -44,6 +42,8 @@ class Down extends DownCommand // are not available with tenants. $payload = $this->getDownDatabasePayload(); + + // This runs for all tenants if no --tenants are specified tenancy()->runForMultiple($this->option('tenants'), function ($tenant) use ($payload){ $this->line("Tenant: {$tenant['id']}"); $tenant->putDownForMaintenance($payload); diff --git a/src/Commands/Up.php b/src/Commands/Up.php index 73dd08f4..91731ada 100644 --- a/src/Commands/Up.php +++ b/src/Commands/Up.php @@ -33,6 +33,7 @@ class Up extends Command */ public function handle() { + // This runs for all tenants if no --tenants are specified tenancy()->runForMultiple($this->option('tenants'), function ($tenant) { $this->line("Tenant: {$tenant['id']}"); $tenant->bringUpFromMaintenance();