/**
  * Rollback migration from the specified module.
  *
  * @param $module
  */
 public function rollback($module)
 {
     if (is_string($module)) {
         $module = $this->laravel['modules']->findOrFail($module);
     }
     $migrator = new Migrator($module);
     $migrated = $migrator->rollback();
     if (count($migrated)) {
         foreach ($migrated as $migration) {
             $this->line("Rollback: <info>{$migration}</info>");
         }
         return;
     }
     $this->comment('Nothing to rollback.');
 }
Пример #2
0
 /**
  * Run the migration from the specified module.
  *
  * @param string $name
  *
  * @return mixed
  */
 protected function migrate($name)
 {
     $module = $this->module->findOrFail($name);
     $migrator = new Migrator($module);
     $migrated = $migrator->migrate();
     if (count($migrated)) {
         foreach ($migrated as $migration) {
             $this->line("Migrated: <info>{$migration}</info>");
         }
         return;
     }
     $this->comment('Nothing to migrate.');
     if ($this->option('seed')) {
         $this->call('module:seed', ['module' => $name]);
     }
 }