/** * Show all products on category page * * @param Category $category * @return Response */ public function showCategory(Category $category) { $products = $category->products()->where('active', 1)->orderBy('created_at', 'DESC')->get(); return view('store.categories.show')->with(compact('products', 'category')); }
public function byCategory(Category $category) { $products = $category->products()->paginate(); return view('home', compact('products')); }