laravel display category post by slug

Solutions on MaxInterview for laravel display category post by slug by the best coders in the world

showing results for - "laravel display category post by slug"
Alessandro
22 Mar 2016
1Route::get(/category/{slug});
2
3    public function postCategory($slug)
4    {
5        $posts = Post::where('slug', $slug)->get();
6
7        return view('front.posts.category', compact('posts'));
8    }
9
Hugo
23 Jul 2018
1    public function postCategory($id)
2    {
3        $posts = Post::where('category_id', $id)->get();
4
5        return view('front.posts.category', compact('posts'));
6    }
7