Im using a resource controller to control articles.
/news
Hits the index method and brings up all the articles under the category.
/news/article-slug
Hits the show method and brings up an article under the category.
My question involves sub categories.
/news/sub-category-name
This would hit the show method which would look for an article with the sub-category-name when I want it to hit the index method and bring up a list of articles for the sub category.
What would be the approach to use for sub categories?
Add another route and method like:
get('/news/{subcategory}', [
'as'=>'subcategory',
'uses'=>'ArticleController@getSubCategory',
]);
Or would it be better practice to scrap sub categories and have a url like:
/news-sub-category-name/article-slug
Or is there another way?
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1OuNHpU
via IFTTT
Aucun commentaire:
Enregistrer un commentaire