Ejemplo n.º 1
0
 public function delete()
 {
     $count = HasProducts::where("prod_id", Input::get('id'))->count();
     if ($count <= 0) {
         $prod = Product::findOrFail(Input::get('id'));
         $prod->categories()->detach();
         $prod->attributes()->detach();
         $prod->relatedproducts()->detach();
         $prod->upsellproducts()->detach();
         $prod->comboproducts()->detach();
         $prod->catalogimgs()->detach();
         $prod->fabrics()->detach();
         $prod->savedlist()->detach();
         $prod->delete();
         return redirect()->back()->with('message', 'Product deleted successfully!');
     } else {
         return redirect()->back()->with('message', 'Sorry This Product is Part of a Project! Delete the Project First!');
     }
 }
Ejemplo n.º 2
0
 public function existDeleteItemCart()
 {
     $order_id = Input::get("od_id");
     $getCart = Order::find($order_id)->cart;
     $cartUpdate = json_decode($getCart);
     //     print_r(Input::get('id'));
     $updateHasProds = HasProducts::find(Input::get('id'));
     $updateHasProds->delete();
     return redirect()->back();
 }