コード例 #1
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire()
 {
     if (!$this->confirmToProceed()) {
         return;
     }
     $slug = $this->argument('slug');
     if (isset($slug)) {
         if (!$this->module->exists($slug)) {
             return $this->error('Module does not exist.');
         }
         if ($this->module->isEnabled($slug)) {
             $this->seed($slug);
         } elseif ($this->option('force')) {
             $this->seed($slug);
         }
         return;
     }
     if ($this->option('force')) {
         $modules = $this->module->all();
     } else {
         $modules = $this->module->enabled();
     }
     foreach ($modules as $module) {
         $this->seed($module['slug']);
     }
 }
コード例 #2
0
 /**
  * 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']);
     }
 }
コード例 #3
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire()
 {
     if (!$this->confirmToProceed()) {
         return;
     }
     $slug = $this->argument('slug');
     if (!empty($slug)) {
         if (!$this->module->exists($slug)) {
             return $this->error('Module does not exist.');
         }
         if ($this->module->isEnabled($slug)) {
             return $this->reset($slug);
         }
     } else {
         $modules = $this->module->enabled()->reverse();
         foreach ($modules as $module) {
             $this->reset($module['slug']);
         }
     }
 }
コード例 #4
0
 /**
  * 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.');
     }
 }
コード例 #5
0
ファイル: MakeCommand.php プロジェクト: nova-framework/system
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire()
 {
     $slug = $this->parseSlug($this->argument('slug'));
     $name = $this->parseName($this->argument('name'));
     if ($this->module->exists($slug)) {
         $this->modulePath = $this->module->getPath();
         $this->moduleInfo = collect($this->module->where('slug', $slug));
         $this->container['slug'] = $slug;
         $this->container['name'] = $name;
         return $this->generate();
     }
     return $this->error('Module ' . $this->container['slug'] . ' does not exist.');
 }
コード例 #6
0
 /**
  * Run migrations for the specified module.
  *
  * @param string $slug
  *
  * @return mixed
  */
 protected function migrate($slug)
 {
     if (!$this->module->exists($slug)) {
         return $this->error('Module does not exist.');
     }
     $pretend = Arr::get($this->option(), 'pretend', false);
     $path = $this->getMigrationPath($slug);
     $this->migrator->run($path, $pretend);
     //
     foreach ($this->migrator->getNotes() as $note) {
         if (!$this->option('quiet')) {
             $this->line($note);
         }
     }
     if ($this->option('seed')) {
         $this->call('module:seed', ['module' => $slug, '--force' => true]);
     }
 }