/** * @param string|Instance $instanceId * * @return bool */ protected function migrateSingleInstance($instanceId) { try { $_capsule = InstanceCapsule::make($instanceId); } catch (ModelNotFoundException $_ex) { $this->error('The instance "' . $instanceId . '" does not exist.'); return ['success' => false, 'output' => 'Instance not found.', 'exit_code' => -1]; } $_output = null; if (0 !== ($_result = $_capsule->call('migrate', $this->option('seed') ? ['--seed' => true] : []))) { \Log::error('Error result "' . $_result . '" returned', ['output' => $_output]); return ['success' => false, 'output' => $_output, 'exit_code' => $_result]; } return ['success' => true, 'output' => $_output, 'exit_code' => $_result]; }
/** @inheritdoc */ public function fire() { parent::fire(); $this->setOutputPrefix('[' . $this->name . ']'); $_instanceId = $this->argument('instance-id'); if ($this->option('destroy')) { InstanceCapsule::unmake($_instanceId); $this->info('* Instance "<comment>' . $_instanceId . '</comment>" capsule destroyed.'); return 0; } $this->info('Encapsulating instance "<comment>' . $_instanceId . '</comment>"'); try { $_capsule = InstanceCapsule::make($_instanceId, false); $this->info('* Instance "<comment>' . $_instanceId . '</comment>" encapsulated in <comment>' . $_capsule->getCapsulePath() . '</comment>.'); return 0; } catch (ModelNotFoundException $_ex) { $this->error('The instance "' . $_instanceId . '" does not exist.'); return 1; } }