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