/**
  * Get all modules.
  *
  * @return array
  */
 protected function getModules()
 {
     $modules = $this->module->all();
     $results = array();
     foreach ($modules as $module) {
         $results[] = $this->getModuleInformation($module);
     }
     return array_filter($results);
 }
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire()
 {
     if (!$this->confirmToProceed()) {
         return null;
     }
     $module = $this->argument('module');
     if ($module) {
         return $this->rollback($module);
     } else {
         foreach ($this->module->all() as $module) {
             $this->rollback($module['slug']);
         }
     }
 }
 /**
  * Seed the specific module.
  *
  * @param  string $module
  * @return array
  */
 protected function seed($module)
 {
     $params = array();
     $moduleName = studly_case($module);
     $namespace = $this->module->getNamespace();
     $rootSeeder = $moduleName . 'DatabaseSeeder';
     $fullPath = $namespace . '\\' . $moduleName . '\\Database\\Seeds\\' . $rootSeeder;
     if (class_exists($fullPath)) {
         if ($this->option('class')) {
             $params['--class'] = $this->option('class');
         } else {
             $params['--class'] = $fullPath;
         }
         if ($option = $this->option('database')) {
             $params['--database'] = $option;
         }
         if ($option = $this->option('force')) {
             $params['--force'] = $option;
         }
         $this->call('db:seed', $params);
     }
 }
 /**
  * Replace placeholder text with correct values.
  *
  * @param  string $content
  * @return string
  */
 protected function formatContent($content)
 {
     return str_replace(['{{className}}', '{{moduleName}}', '{{namespace}}'], [$this->className, $this->moduleName, $this->module->getNamespace()], $content);
 }
 /**
  * Get migrations path.
  *
  * @return string
  */
 protected function getMigrationPath($slug)
 {
     $path = $this->module->getModulePath($slug) . 'Database/Migrations';
     return $path;
 }
 /**
  * Get module migration path.
  *
  * @return string
  */
 protected function getPath()
 {
     $path = $this->module->getModulePath($this->moduleName);
     return $path . 'Database/Migrations/';
 }