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 tag($id)
 {
     $categories = Category::all();
     $tag = Category::find($id);
     $products = Product::ofTag($id)->get();
     $name = 'Tag: ' . $tag->name;
     return view('store.category', compact('categories', 'products', 'name'));
 }
Example #5
0
 public function category($id)
 {
     $category = Category::find($id);
     if ($category) {
         $categories = Category::all();
         $categorie_name = $category->name;
         $products = Category::find($id)->products;
     } else {
         return redirect()->route('store.index');
     }
     return view('store.products', compact('categories', 'categorie_name', 'products'));
 }
 public function listProductsCategory($id)
 {
     $categories = $this->category->all();
     $category = $this->category->find($id);
     return view('store.products_categorie', compact('category', 'categories'));
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     $this->category->find($id)->delete();
     return redirect()->route('categories.index');
 }
 public function category($id)
 {
     $category = Category::find($id);
     $categories = Category::all();
     return view('store.categories', compact('categories', 'category'));
 }
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function show($id)
 {
     $cateogy = $this->category->find($id);
     return $cateogy->name;
 }
 public function listByCategory($id)
 {
     $category = Category::find($id);
     return view('store.category', compact('category'));
 }