本文整理汇总了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();
}
示例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');
}
示例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');
}
示例4: destroy
function destroy(Product $product)
{
$product->delete();
return redirect('products');
}
示例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');
}
示例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);
}
示例7: destroy
public function destroy(Product $product)
{
$product->delete();
\Flash::success('Your product Deleted');
return redirect('products');
}
示例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');
}
}
示例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');
}
示例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');
}
示例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);
}
示例12: deactivate
public function deactivate(Product $product)
{
$product->delete();
//return redirect('/')->with('message', 'Izdelek uspešno deaktiviran.');
}
示例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}");
}
示例14: destroy
/**
* Remove the specified resource from storage.
*
* @param Product $product
* @return Response
*/
public function destroy($product)
{
$product->delete();
}
示例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' => '删除失败, 请重试'];
}