public function images($id) { if ($id) { $product = PhoneProduct::find($id); if ($product) { return view('home.product.image')->withProduct($product); } } return redirect()->back(); }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { if ($id) { $skus = PhoneSku::where('product_id', '=', $id)->get(); if ($skus) { foreach ($skus as $sku) { $sku->delete(); } } $product = PhoneProduct::find($id); $product->delete(); } return redirect()->back(); }