public function show($id) { // $post = Post::where('slug', $id)->first(); $post = Post::findBySlug($id)->first(); // $post = Post::findBySlugOrIdOrFail($id)->first(); // dd($post->toArray()); return view('post', compact('post')); }
/** * Display the specified resource. * * @param int $id * @return Response */ public function show($id) { if (Auth::guest()) { App::abort(403, 'Access denied'); } $post = Post::findBySlug($id); return view('posts.show')->with('post', $post); }
public function article($slug) { $post = Post::findBySlug($slug); return view('article', compact('post')); }
/** * Display the specified resource. * * @param int $slug * @return Response */ public function historia($slug) { $post = \App\Post::findBySlug($slug); $categoria = Categoria::lists('name'); $rand = array_rand(["#f77985" => "saude", "#be1039" => "educacao", "#69b843" => "infra", "#f87e3a" => "cidadania", "#2a9fe0" => "meio", "#ad4b9e" => "esporte"]); return view('templates.post', compact('post', 'categoria', 'rand')); }
public function view($slug) { $categorias = Categoria::all(); $post = Post::findBySlug($slug); return view('post', compact('post', 'categorias')); }