Example #1
0
 /**
  * Execute the console command.
  */
 public function handle()
 {
     $module = $this->getModuleName();
     $moduleName = studly_case($module);
     $force = $this->getBooleanOption('force');
     if (isset($module)) {
         if (!$this->module->exists($module)) {
             $this->error("Module [{$moduleName}] does not exist.");
         } elseif ($this->module->isEnabled($module) || $force) {
             $this->seed($module, $force);
         }
     } else {
         $this->seedAll($force);
     }
 }
Example #2
0
 /**
  * Run migrations for the specified module.
  *
  * @param  string  $slug
  */
 private function migrate($slug)
 {
     $moduleName = studly_case($slug);
     if (!$this->module->exists($moduleName)) {
         $this->error("Module [{$moduleName}] does not exist.");
         return;
     }
     $this->migrator->run($this->getMigrationPath($slug), $this->getBooleanOption('pretend'));
     // Once the migrator has run we will grab the note output and send it out to
     // the console screen, since the migrator itself functions without having
     // any instances of the OutputInterface contract passed into the class.
     foreach ($this->migrator->getNotes() as $note) {
         if (!$this->option('quiet')) {
             $this->output->writeln($note);
         }
     }
     // Finally, if the "seed" option has been given, we will re-run the database
     // seed task to re-populate the database, which is convenient when adding
     // a migration and a seed at the same time, as it is only this command.
     if ($this->getBooleanOption('seed')) {
         $this->call('module:seed', ['module' => $slug, '--force' => true]);
     }
 }