/**
  * Generate migration.
  */
 public function generateMigrations()
 {
     if (!$this->confirm('Do you want to create a migration?')) {
         return;
     }
     if ($this->console->argument('name')) {
         foreach ($this->getAllTables() as $table) {
             $this->console->call('generate:migration', ['name' => "create_{$this->getEntities($table)}_table", '--fields' => $table->serializeFields(), '--force' => $this->console->option('force')]);
         }
     } else {
         $this->console->call('generate:migration', ['--connection' => $this->console->option('connection'), '--tables' => $this->console->option('tables'), '--ignore' => $this->console->option('ignore'), '--default-index-names' => $this->console->option('default-index-names'), '--default-fk-names' => $this->console->option('default-fk-names'), '--force' => $this->console->option('force')]);
     }
 }
Example #2
0
 /**
  * Get entity name.
  *
  * @return string
  */
 public function getEntity()
 {
     return strtolower(str_singular($this->console->argument('entity')));
 }