public function category($id) { $categories = $this->category->all(); $category = $this->category->find($id); $products = $this->product->ofCategory($id)->get(); return view('store.category', compact('categories', 'category', 'products')); }
public function category($id) { $categories = Category::all(); $category = Category::find($id); $products = Product::ofCategory($id)->get(); return view('store.category', compact('categories', 'category', 'products')); }
public function categoryScope($id, Category $cat, Product $prod) { $categories = $cat->all(); $category = $cat->find($id); $products = $prod->ofCategory($id)->get(); return view('store.category', compact('categories', 'products', 'category')); }
public function productsCategory(Category $category, Product $product, $id) { $categories = $category->all(); $category = $category->find($id); $prodcutsCateogry = $product->ofCategory($id)->get(); $tags = $this->tag->all(); return view('store.productsCategory', compact('categories', 'category', 'prodcutsCateogry', 'tags')); }