public function show($slug) { $posts = Post::withTopic($slug); $topic = Topic::where('slug', '=', $slug)->first(); if ($topic) { return view('topics.show')->with(['posts' => $posts, 'topic' => $topic]); } else { App::abort(404); } }