Nwidart\Modules\Migrations\Migrator::setDatabase PHP Method

setDatabase() public method

Set the database connection to be used
public setDatabase ( $database )
$database
    public function setDatabase($database)
    {
        if (is_string($database) && $database) {
            $this->database = $database;
        }
    }

Usage Example

 /**
  * Rollback migration from the specified module.
  *
  * @param $module
  */
 public function reset($module)
 {
     if (is_string($module)) {
         $module = $this->module->findOrFail($module);
     }
     $migrator = new Migrator($module);
     $database = $this->option('database');
     if (!empty($database)) {
         $migrator->setDatabase($database);
     }
     $migrated = $migrator->reset();
     if (count($migrated)) {
         foreach ($migrated as $migration) {
             $this->line("Rollback: <info>{$migration}</info>");
         }
         return;
     }
     $this->comment('Nothing to rollback.');
 }