protected function getPath() { $layout = $this->cache->getValue('layout'); if (empty($layout)) { return parent::getPath(); } else { return str_replace('scaffold', $layout, parent::getPath()); } }
/** * Get the path to the file that should be generated. * * @return string */ protected function getPath() { $namespace = $this->cache->getValue('namespace'); if (empty($namespace)) { return $this->option('path') . '/' . ucwords($this->argument('name')) . '.php'; } else { return $this->option('path') . '/' . ucwords($namespace) . '/' . ucwords($this->argument('name')) . '.php'; } }
/** * Call generate:views * * @return void */ protected function generateViews() { $viewsDir = app_path() . '/views'; $namespace = $this->cache->getValue('namespace'); $container = empty($namespace) ? $viewsDir . '/' . Pluralizer::plural($this->model) : $viewsDir . '/' . $namespace . '/' . Pluralizer::plural($this->model); $layouts = $viewsDir . '/layouts'; $helpers = $viewsDir . '/helpers'; $views = array('index', 'show', 'create', 'edit', 'fields', 'error_messages'); $this->generator->folders(array($container)); // If generating a scaffold, we also need views/layouts/scaffold if (get_called_class() === 'Dollar\\Generators\\Commands\\ScaffoldGeneratorCommand') { $views[] = 'scaffold'; $this->generator->folders($layouts); } // Let's filter through all of our needed views // and create each one. foreach ($views as $view) { $path = $container; if ($view === 'scaffold') { $path = $layouts; } if ($view === 'error_messages') { $path = $helpers; } $this->generateView($view, $path); } }