laravel['modules']->findOrFail($this->getModuleName()); $path = str_replace('/', '\\', config('modules.paths.generator.module-settings-view')); return (new Stub('/module-settings-view.stub', [ 'MODULE_NAME' => $module->getName(), 'LOWER_NAME' => $module->getLowerName(), 'SHOW_ROUTES' => $this->option('route') ? true : false ]))->render(); } public function fire() { $this->info('Creating settings view template for ' . $this->getModuleName()); $module = $this->laravel['modules']->findOrFail($this->getModuleName()); parent::fire(); // add default routes if option specified $route = $this->option('route'); if ($route) { file_put_contents( $this->getModuleRoutesFilePath(), (new Stub('/module-settings-routes.stub', [ 'MODULE_NAME' => $module->getName(), 'LOWER_NAME' => $module->getLowerName(), ]))->render(), FILE_APPEND ); $this->info('Added routes to module routes.php.'); } } protected function getModuleRoutesFilePath() { $path = $this->laravel['modules']->getModulePath($this->getModuleName()); $seederPath = $this->laravel['modules']->config('paths.generator.module-settings-routes'); return $path . $seederPath . '/routes.php'; } public function getDestinationFilePath() { $path = $this->laravel['modules']->getModulePath($this->getModuleName()); $seederPath = $this->laravel['modules']->config('paths.generator.module-settings-view'); return $path . $seederPath . '/' . $this->getFileName(); } protected function getArguments() { return [ ['module', InputArgument::REQUIRED, 'The name of the module.'] ]; } protected function getOptions() { return [ ['route', null, InputOption::VALUE_NONE, 'Add default routes.', null] ]; } /** * @return string */ protected function getFileName() { return 'settings.blade.php'; } }