public function productCategory($id) { $pCategory = Product::ProductCategory($id)->get(); $category = $this->category->find($id); $categories = Category::all(); if ($category) { return view('store.category', compact('categories', 'products', 'pCategory')); } return redirect()->route('store.index')->with('category_exist', 'Category not exist!'); }