/** * 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.'); }
/** * 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); }