/** * Display the specified resource. * * @param int $slug * @return Response */ public function show($slug) { $article = Article::findBySlug($slug); if ($article->published == 0) { abort(404); } return view('blog.articles.show', compact('article')); }
public function articulo($slug) { $article = Article::findBySlug($slug); $my_tags = $article->tags; $article->category; $article->images; $article->comments; return view('front.show')->with('article', $article)->with('my_tags', $my_tags); }
/** * Display the specified resource. * * @param int $id * * @return Response */ public function show($slug) { $article = Article::findBySlug($slug); return view('home.articles.show', compact('article')); }
/** * Get the article from a slug, checks if it exists, if not redirect with a flash message * * @param string $slug * @param boolean $published * * @return mixed */ protected function _getArticleOrFail($slug, $published = false) { if ($published) { $article = Article::findBySlug($slug)->where('published_at', '<=', Carbon::now()); } else { $article = Article::findBySlug($slug); } if (!$article) { redirect(route('articles.index'))->with('error', 'This article does not exist or has not been published yet!'); } return $article; }
public function show($id) { $article = Article::findBySlug($id); return view('sample.show', compact('article')); }