/** * Execute the console command. * * @return null|int */ protected function fire() { $ran = $this->migrator->getRanMigrations(); if (empty($ran)) { return $this->info('Nothing to rollback'); } $migration = $ran[count($ran) - 1]; $this->input->getOption('hard') ? $this->hardRollbackMigration($migration) : $this->rollbackMigration($migration); return $this->deleteIfNeeded($migration); }
/** * Show old migrations. * * @return void */ protected function showOldMigrations() { $old = collect($this->migrator->getRanMigrations()); $this->output->writeln("<fg=yellow>Old migrations:\r\n</>"); $max = 5; if ($old->count() > $max) { $this->output->writeln('<fg=yellow>...</>'); $old = $old->take(-$max); } foreach ($old as $migration) { $this->output->writeln("<fg=yellow>{$migration}.php</>"); } }