/**
  * 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'));
 }
示例#2
0
 public function byCategory(Category $category)
 {
     $products = $category->products()->paginate();
     return view('home', compact('products'));
 }