I need basic help, as I am new to Laravel.
Situation
I have a controller ArticlesController which has index method which lists all articles and it's working fine. This route below, allows me to show individual articles by 'id' like this articles/id example articles/35 . But i also need to show all articles from category "Swimming" . When I hit articles/swimming it will look for id=swimming. But I don't know how to make custom route to list all articles from "Swimming" category. I have made a method "swimming" inside controller but I need help with route?
Route::bind('articles', function($value, $route) {
return $list = App\Article::whereid($value)->first();
});
Route::get('articles/category/{cat}', function($value){ return $list = App\Article::where('category','=',$value')->first(); })