/**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire()
 {
     // SR [2016-05-06] Don't need the confirmation and
     // it does not work when called from controller with Artisan::call().
     //        	if (! $this->confirmToProceed()) return null;
     $slug = $this->argument('slug');
     if ($slug) {
         return $this->rollback($slug);
     } else {
         foreach ($this->module->all() as $module) {
             $this->rollback($module['slug']);
         }
     }
 }
 /**
  * Seed the specific module.
  *
  * @param  string $module
  * @return array
  */
 protected function seed($slug)
 {
     $module = $this->module->where('slug', $slug)->first();
     $params = [];
     $namespacePath = $this->module->getNamespace();
     $rootSeeder = $module['namespace'] . 'DatabaseSeeder';
     $fullPath = $namespacePath . '\\' . $module['namespace'] . '\\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);
     }
 }
 /**
  * Get migrations path.
  *
  * @return string
  */
 protected function getMigrationPath($slug)
 {
     $path = $this->module->getModulePath($slug) . 'Database/Migrations';
     return $path;
 }
 /**
  * Returns module manifest information.
  *
  * @param string  $module
  * @return array
  */
 protected function getModuleInformation($module)
 {
     return ['#' => $module['order'], 'name' => $module['name'], 'slug' => $module['slug'], 'description' => $module['description'], 'status' => $this->module->isEnabled($module['slug']) ? 'Enabled' : 'Disabled'];
 }
 /**
  * Replace placeholder text with correct values.
  *
  * @return string
  */
 protected function formatContent($content)
 {
     return str_replace(['{{slug}}', '{{name}}', '{{namespace}}', '{{version}}', '{{description}}', '{{author}}', '{{license}}', '{{path}}'], [$this->container['slug'], $this->container['name'], $this->container['namespace'], $this->container['version'], $this->container['description'], $this->container['author'], $this->container['license'], $this->module->getNamespace()], $content);
 }