option('momi')) { $this->input->setOption('create_model', $this->option('momi')); $this->input->setOption('create_migration', $this->option('momi')); } if ($this->option('create_model')) { $this->createModel(); } if ($this->option('create_migration')) { $this->createMigration(); } if ($this->option('add_migration')) { $this->addMigration(); } } private function createModel() { try { $path = trim($this->argument('name')); $model = Str::singular(class_basename($this->option('create_model'))); $this->call('make:model', [ 'name' => 'App\\Modules\\' . $path . '\\Models\\' . $model ]); } catch (\Exception $e) { $e->getMessage(); } } private function createMigration() { $path = trim($this->argument('name')); $table = Str::plural(Str::snake(class_basename($this->option('create_migration')))); try { $this->call('make:migration', [ 'name' => 'create_' . $table . '_table', '--create' => $table, '--path' => 'app/Modules/' . $path . '/Database/Migrations' ]); } catch (\Exception $e) { $e->getMessage(); } } private function addMigration() { $path = trim($this->argument('name')); $table = $this->option('add_migration'); try { $this->call('make:migration', [ 'name' => $table, '--path' => 'app/Modules/' . $path . '/Database/Migrations' ]); } catch (\Exception $e) { $e->getMessage(); } } }