/**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire()
 {
     if (!$this->confirmToProceed()) {
         return;
     }
     $slug = $this->argument('slug');
     if ($slug) {
         if (!$this->module->exists($slug)) {
             return $this->error('Module does not exist.');
         }
         return $this->rollback($slug);
     }
     foreach ($this->module->all() as $module) {
         $this->rollback($module['slug']);
     }
 }
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire()
 {
     if (!$this->confirmToProceed()) {
         return;
     }
     $slug = $this->argument('slug');
     if (!$this->module->exists($slug)) {
         return $this->error('Module does not exist.');
     }
     $this->call('module:migrate:reset', array('slug' => $slug, '--database' => $this->option('database'), '--pretend' => $this->option('pretend')));
     $this->call('module:migrate', array('slug' => $slug, '--database' => $this->option('database')));
     if ($this->needsSeeding()) {
         $this->runSeeder($slug, $this->option('database'));
     }
     if (isset($slug)) {
         $this->info('Module has been refreshed.');
     } else {
         $this->info('All modules have been refreshed.');
     }
 }
 /**
  * Seed the specific module.
  *
  * @param string $module
  *
  * @return array
  */
 protected function seed($slug)
 {
     $module = $this->module->where('slug', $slug);
     $params = array();
     $namespacePath = $this->module->getNamespace();
     $rootSeeder = $module['namespace'] . 'DatabaseSeeder';
     $fullPath = $namespacePath . '\\' . $module['namespace'] . '\\Database\\Seeds\\' . $rootSeeder;
     if (!class_exists($fullPath)) {
         return;
     }
     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)
 {
     return $this->module->getModulePath($slug) . 'Database' . DS . 'Migrations';
 }
 /**
  * Replace placeholder text with correct values.
  *
  * @return string
  */
 protected function formatContent($content)
 {
     $searches = array('{{slug}}', '{{name}}', '{{namespace}}', '{{version}}', '{{description}}', '{{author}}', '{{email}}', '{{homepage}}', '{{license}}', '{{path}}');
     $replaces = array($this->container['slug'], $this->container['name'], $this->container['namespace'], $this->container['version'], $this->container['description'], $this->container['author'], $this->container['email'], $this->container['homepage'], $this->container['license'], $this->module->getNamespace());
     return str_replace($searches, $replaces, $content);
 }
Beispiel #6
0
 /**
  * Get the configured module base namespace.
  *
  * @return string
  */
 protected function getBaseNamespace()
 {
     return $this->module->getNamespace();
 }
 /**
  * Returns module manifest information.
  *
  * @param string $module
  *
  * @return array
  */
 protected function getModuleInformation($module)
 {
     $enabled = $this->module->isEnabled($module['slug']);
     return array('#' => $module['order'], 'name' => $module['name'], 'slug' => $module['slug'], 'description' => $module['description'], 'status' => $enabled ? 'Enabled' : 'Disabled');
 }
 /**
  * Get migration directory path.
  *
  * @param string $slug
  *
  * @return string
  */
 protected function getMigrationPath($slug)
 {
     $path = $this->module->getModulePath($slug);
     return $path . 'Database' . DS . 'Migrations' . DS;
 }