Пример #1
0
 private function deleteProduct(Product $product)
 {
     $product->delete();
 }
Пример #2
0
 /**
  * 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');
 }
Пример #3
0
 /**
  * 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');
 }
Пример #5
0
 /**
  * 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');
 }
Пример #6
0
 /**
  * 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);
 }
Пример #7
0
 public function destroy(Product $product)
 {
     $product->delete();
     \Flash::success('Your product Deleted');
     return redirect('products');
 }
Пример #8
0
 /**
  * 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');
     }
 }
Пример #9
0
 /**
  * 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');
 }
Пример #10
0
 /**
  * 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');
 }
Пример #11
0
 /**
  * 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);
 }
Пример #12
0
 public function deactivate(Product $product)
 {
     $product->delete();
     //return redirect('/')->with('message', 'Izdelek uspešno deaktiviran.');
 }
Пример #13
0
 /**
  * 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}");
 }
Пример #14
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  Product $product
  * @return Response
  */
 public function destroy($product)
 {
     $product->delete();
 }
Пример #15
0
 /**
  * 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' => '删除失败, 请重试'];
 }
Пример #16
0
 /**
  * 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);
 }
Пример #17
0
 /**
  * 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');
 }
Пример #18
0
 /**
  * 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;
     }
 }