private function deleteProduct(Product $product) { $product->delete(); }
/** * Destroy the given task. * * @param Request $request * @param Task $task * @return Response */ public function destroy(Request $request, Product $product) { //$this->authorize('destroy', $product); $product->delete(); return redirect('/product'); }
/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy(Product $product) { $product->delete(); return redirect('product/manage'); }
function destroy(Product $product) { $product->delete(); return redirect('products'); }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy(Product $product) { if ($product) { $product->delete(); return Redirect::to('products')->with('message', 'Product Deleted'); } return Redirect::to('products')->with('message', 'something went wrong, please try again'); }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy(Product $product) { $deleted = $product->delete(); $message = $deleted ? 'Producto eliminado correctamente!' : 'El producto NO pudo eliminarse'; return redirect()->route('admin.product.index')->with('message', $message); }
public function destroy(Product $product) { $product->delete(); \Flash::success('Your product Deleted'); return redirect('products'); }
/** * Store a newly created resource in storage. * * @param Request $request * @return Response */ public function store(Request $request) { if (session('user')) { $validator = Validator::make($request->all(), ['name' => 'required|min:4', 'description' => 'required|min:8', 'price' => 'required|numeric|min:1', 'rating' => 'required|numeric|min:1', 'image' => 'required|mimes:jpg,bmp,png,jpeg', 'category' => 'required|numeric|exists:categories,id']); if (!$validator->fails()) { $product = new Product(); $product->name = ucfirst(strtolower($request->input("name"))); $product->description = ucfirst(strtolower($request->input("description"))); $product->image = $request->input("image"); $product->price = ucfirst(strtolower($request->input("price"))); $product->rating = ucfirst(strtolower($request->input("rating"))); $product->image = "null"; $product->category_id = ucfirst(strtolower($request->input("category"))); $product->merchant_id = session('user'); $product->save(); $product->id = $product->id; $product->save(); // //dynamically assign images to var // if($imageName ='product'.$product->id){ // $count = 0 ; // foreach($request->file('image') as $tempImage){ // $count++; // ${"image".$count} = $tempImage; // // } // //create unassigned imgs from first img // //die(&$count); // if($count< 4 ) // { // $rem = 4 - $count; // // for($i=1;$rem >=$i;$i++) // { // // $count++; // // ${"image".$count} = $image1; // } // // // } // // createCollage($image1, $image2, $image3, $image4, // $imageName); if ($imageName = 'product' . $product->id) { $request->file('image')->move(base_path() . '/public/images/', $imageName); Session::flash('color', '#0ae'); Session::flash('flash_message', $product->name . ' just been added'); return redirect()->route('products.index'); } else { $product->delete(); Session::flash('color', 'red'); Session::flash('flash_message', 'For some reason the product ' . $product->name . 'could not be added'); return redirect()->route('products.index'); } } else { $errors = $validator->messages(); return redirect('products/create')->with('errors', $errors)->withInput(); } } else { return view('landingpage.index'); } }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy(Product $product) { $product->delete(); \Flash::success('Your product has been Deleted'); return redirect()->route('admin.products.index'); }
/** * Remove the specified resource from storage. * * @param Product $product * @return \Illuminate\Http\Response */ public function destroy(Product $product) { $product->delete(); $this->message->flash("PUNY HUMAN - You DESTROYED your Product!"); return redirect()->route('backend.products.index'); }
/** * Remove the specified resource from storage. * */ public function destroy(Product $product) { $deleted = $product->delete(); $message = $deleted ? "Producto eliminado correctamente" : "Error al eliminar"; return redirect()->route('admin.product.index')->with('message', $message); }
public function deactivate(Product $product) { $product->delete(); //return redirect('/')->with('message', 'Izdelek uspešno deaktiviran.'); }
/** * destroy the current product * @param Product $product * @return [type] */ public function destroy(Product $product) { $product->delete(); return redirect()->route('admin.products.index')->withWarning("You just removed product {$product->name}"); }
/** * Remove the specified resource from storage. * * @param Product $product * @return Response */ public function destroy($product) { $product->delete(); }
/** * Delete a product * * @param Product $product * @return \Illuminate\Http\RedirectResponse * @throws \Exception */ public function deleteProduct(Product $product) { return $product->delete() ? ['status' => 'success', 'message' => '成功删除产品'] : ['status' => 'error', 'message' => '删除失败, 请重试']; }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy(Product $product) { $deleted = $product->delete(); $message = $deleted ? 'Product was successfully deleted!' : 'Could not delete the product!'; return redirect()->route('admin.product.index')->with('message', $message); }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy(Product $product) { try { $product->delete(); } catch (QueryException $e) { return redirect('products')->with('error', 'Product cant be deleted, because its been already ordered !'); } return redirect('products'); }
/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy(Product $product, Request $request) { if ($product->delete()) { if ($request->ajax()) { return response()->json(['delid' => $product->id]); } else { return back()->with('success', 'محصول از سبد خرید حذف شد.'); } } if ($request->ajax()) { return response()->json(['result' => false]); } else { return redirect()->home()->with('fail', 'خطا در اتصال به پایگاه داده.'); } }
public function delete(Request $request, Product $product) { $product->delete(); return redirect('/product'); }
/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy(Product $product) { $delete = $product->delete(); if ($delete) { return 0; } else { return 1; } }