public function delete($category_id) { # code... $categories = Category::all(); $category = $categories->find($category_id); if ($category) { flash('Your category (' . $category->category_name . ') is will be removed when your administrator will approve.'); $category->delete(); } else { flash('Your category (' . $category->category_name . ') is already removed or not in your list. Please contact your administrator to know category removal policy'); } return redirect()->route('user::categories'); }
public function edit($product_id) { //edit the product $productsCount = 0; $products = Auth::user()->products; $product = $products->find($product_id); $categories = Category::all(); // return redirect()->route('user::products')->with(compact('productsCount', 'products', 'categories')); return view('add-product', compact('productsCount', 'products', 'categories'))->withUser(Auth::user()); }