/** * 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'); }
/** * 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; }
/** * 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')); }