/** * Show the edit trick page. * * @param string $slug * * @return \Response */ public function getEdit($slug) { $trick = $this->trick->findBySlug($slug); $tagList = $this->tags->listAll(); $categoryList = $this->categories->listAll(); $selectedTags = $this->trick->listTagsIdsForTrick($trick); $selectedCategories = $this->trick->listCategoriesIdsForTrick($trick); return view('tricks.edit', ['tagList' => $tagList, 'selectedTags' => $selectedTags, 'categoryList' => $categoryList, 'selectedCategories' => $selectedCategories, 'trick' => $trick]); }
/** * Execute the console command. * @return void */ public function fire() { $path = \Config::get('recipe.document_path'); $categories = scandir($path); foreach ($categories as $directory) { $category = $this->category->getCategoryFromSlug($directory); if ($category) { $files = "{$path}/{$directory}"; if ($scan = scandir($files)) { // insert $this->addRecipes($scan, $files, $category); } } } }
/** * @param $id * @return \Illuminate\Http\JsonResponse */ public function show($id) { $input = \Input::get('format', 'json'); $array = []; $recipe = $this->recipe->getRecipe($id); if ($recipe) { $category = $this->category->getCategory($recipe->category_id); $array = ['id' => $recipe->recipe_id, 'title' => $recipe->title, 'problem' => $recipe->problem, 'category' => ['description' => $category->description, 'name' => $category->name]]; } // render for hypermedia if ($input == 'hal') { $this->hal->setUri(route('home.recipe', ['one' => $id])); $this->hal->setData($array); $array = $this->hal; } return $this->render($array, $input); }
/** * @access private * @return mixed */ private function getContentsRanking() { $result = $this->analytics->getSortedCount(0, 6); if ($result) { foreach ($result as $row) { $recipe = $this->recipe->getRecipe($row->recipe_id); $category = $this->category->getCategory($recipe->category_id); $row->category_id = isset($recipe->category_id) ? $recipe->category_id : null; $row->title = isset($recipe->title) ? $recipe->title : null; $row->name = isset($category->name) ? $category->name : null; } } return $result; }
/** * 実行 * @param null $one * @return \Illuminate\Http\RedirectResponse */ public function postApply($one = null) { if (\Input::get('_return')) { return \Redirect::route('webmaster.category.form', ['id' => $one])->withInput(); } $request = \Input::only(['section_id', 'name', 'description']); try { // added if (is_null($one)) { $this->category->addCategory($request); // updated } else { $this->category->updateCategory($one, $request); } // session remove \Session::forget(self::SESSION_KEY); $this->view('webmaster.category.apply', ['id' => $one]); } catch (\Illuminate\Database\QueryException $e) { return \Redirect::route('webmaster.category.form', ['one' => $one])->withErrors(['name' => 'そのカテゴリーはすでに使用されています'])->withInput(); } }
/** * Delete a category from the database. * * @param mixed $id * * @return \Illuminate\Http\RedirectResponse */ public function getDelete($id) { $this->categories->delete($id); return $this->redirectRoute('admin.categories.index'); }
/** * Return all the categories for the course. * * @param Course $course * @return mixed */ public function getCourseCategories(Course $course) { return $this->repository->getCourseCategories($course); }
/** * @param $view * @return void */ public function compose($view) { $view->with('categories', $this->category->getNavigationCategory()); }
/** * Get all the categories to include in the sitemap. * * @return \Illuminate\Database\Eloquent\Collection|\App\Category[] */ public function getCategories() { return $this->categories->findAll(); }
/** * Show the categories index. * * @return \Response */ public function getCategoryIndex() { $categories = $this->categories->findAllWithTrickCount(); return view('browse.categories', compact('categories')); }