예제 #1
0
 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request $request
  * @param  int $id
  * @return \Illuminate\Http\Response
  */
 public function update(ProductRequest $request, $id)
 {
     $product = Product::findOrfail($id);
     $product->fill($request->all());
     $product->save();
     return redirect(route('products.' . $product->section))->with('message', 'Producto actualizado corectamente');
 }
예제 #2
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  Product $product
  * @return Response
  */
 public function destroy(Product $product, $id)
 {
     $productId = Product::findOrfail($id);
     $productId->delete();
     echo $productId;
 }
예제 #3
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit($id)
 {
     $product = Product::findOrfail($id);
     return view('product.edit', compact('product'));
 }