public function postDeletePhoto($id) { $photo = productPictures::find($id); $product_id = $photo->product_id; $photo->forceDelete(); return redirect('products/' . $product_id); }
public function postItemDescription($id) { $data['product'] = products::find($id); $data['productPictures'] = productPictures::where('product_id', $id)->get(); if (isset($_POST['addtocart'])) { Cart::add(['id' => $data['product']->id, 'name' => $data['product']->productName, 'price' => $data['product']->sellingprice, 'quantity' => 1, 'attributes' => array()]); return redirect('/mycart'); } return view('single', $data); }