/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { if (!Product::destroy($id)) { return back()->with('error', 'Unable to delete product.'); } return redirect::to('/products')->with('success', 'Product deleted.'); }
/** * Remove the specified resource from storage. * * @param int $id * * @return Response */ public function destroy($id) { Product::destroy($id); Session::flash('flash_message', 'Product deleted!'); return redirect('products'); }
public function destroy($id) { Product::destroy($id); return redirect('admin/products'); }
public function postDelete() { if (Input::has('id')) { DB::transaction(function () { $product = Product::find(Input::get('id')); if (!empty($product->image)) { File::delete($product->image); } if (!empty($product->thumbnail)) { File::delete($product->thumbnail); } Product::destroy(Input::get('id')); echo "1"; }); } else { echo "0"; } }
/** * Remove the specified resource from storage. * * @param int $id * * @return Response */ public function destroy($id) { $currentProduct = Product::find($id); $currentProduct->image; if (!empty($currentProduct->image) && file_exists(public_path($currentProduct->image))) { unlink(public_path($currentProduct->image)); } Product::destroy($id); Session::flash('flash_message', 'Product deleted!'); return redirect()->back(); }