当前位置: 首页>>代码示例>>PHP>>正文


PHP Product::delete方法代码示例

本文整理汇总了PHP中app\Product::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP Product::delete方法的具体用法?PHP Product::delete怎么用?PHP Product::delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在app\Product的用法示例。


在下文中一共展示了Product::delete方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: deleteProduct

 private function deleteProduct(Product $product)
 {
     $product->delete();
 }
开发者ID:polytechlyon-isi2,项目名称:AgnamStore,代码行数:4,代码来源:ProductTrait.php

示例2: destroy

 /**
  * 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');
 }
开发者ID:aducworth,项目名称:inventory,代码行数:13,代码来源:ProductController.php

示例3: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy(Product $product)
 {
     $product->delete();
     return redirect('product/manage');
 }
开发者ID:nasikgiga,项目名称:onlineshop,代码行数:11,代码来源:ProductController.php

示例4: destroy

 function destroy(Product $product)
 {
     $product->delete();
     return redirect('products');
 }
开发者ID:BrunoQuaresma,项目名称:tutorials,代码行数:5,代码来源:ProductsController.php

示例5: destroy

 /**
  * 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');
 }
开发者ID:shima-rahman,项目名称:lina,代码行数:14,代码来源:ProductController.php

示例6: destroy

 /**
  * 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);
 }
开发者ID:kazamax,项目名称:tienda,代码行数:12,代码来源:ProductController.php

示例7: destroy

 public function destroy(Product $product)
 {
     $product->delete();
     \Flash::success('Your product Deleted');
     return redirect('products');
 }
开发者ID:amiralii,项目名称:motoTest,代码行数:6,代码来源:ProductsController.php

示例8: store

 /**
  * 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');
     }
 }
开发者ID:EDDYMENS,项目名称:Zowy,代码行数:69,代码来源:ProductController.php

示例9: destroy

 /**
  * 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');
 }
开发者ID:maherelgamil,项目名称:ketabat,代码行数:12,代码来源:ProductsController.php

示例10: destroy

 /**
  * 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');
 }
开发者ID:SpencerRohan,项目名称:tutorial-2,代码行数:12,代码来源:Products.php

示例11: destroy

 /**
  * 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);
 }
开发者ID:aleksAE,项目名称:Store-Laravel5.1,代码行数:10,代码来源:ProductController.php

示例12: deactivate

 public function deactivate(Product $product)
 {
     $product->delete();
     //return redirect('/')->with('message', 'Izdelek uspešno deaktiviran.');
 }
开发者ID:vidmahovic,项目名称:ep-store,代码行数:5,代码来源:ProductController.php

示例13: destroy

 /**
  * 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}");
 }
开发者ID:Yismen,项目名称:solpieles,代码行数:10,代码来源:ProductsController.php

示例14: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param  Product $product
  * @return Response
  */
 public function destroy($product)
 {
     $product->delete();
 }
开发者ID:uicestone,项目名称:SmartBuild,代码行数:10,代码来源:ProductController.php

示例15: deleteProduct

 /**
  * 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' => '删除失败, 请重试'];
 }
开发者ID:CaliProject,项目名称:mikenong-dev,代码行数:11,代码来源:ManageController.php


注:本文中的app\Product::delete方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。