database = $database; $this->setName('tenants:migrate'); $this->specifyParameters(); } /** * Execute the console command. * * @return mixed */ public function handle() { if (! $this->confirmToProceed()) { return; } $originalTenant = tenancy()->getTenant(); tenancy()->all($this->option('tenants'))->each(function ($tenant) { $this->line("Tenant: {$tenant['id']}"); $this->input->setOption('database', $tenant->getConnectionName()); tenancy()->initialize($tenant); // Migrate parent::handle(); tenancy()->endTenancy(); }); if ($originalTenant) { tenancy()->initialize($originalTenant); } } }