I'm trying to show products related to the category. In my menu I have a list of categories if I click this category i want to see related products to this category. I'm just learning laravel can somebody help me out..
DATABASE:
-categories: ID, NAME
-products: has Category_id
View
Route::get('/category' , [
'uses' => 'productController@getCategory',
'as' => 'category.single'
]);
Controller
public function getCategory($category) {
$singleCategory = Category::find($category);
return view('pages.category', ['category' => $singleCategory]);
}
How do I go from here?