コード例 #1
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit($id)
 {
     $category = Category::lists('name', 'id');
     $product = Product::find($id);
     return view('products.edit', compact('category'), ['product' => $product]);
 }
コード例 #2
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     Category::destroy($id);
     Session::flash('message', 'Categoria excluida com sucesso');
     return Redirect::to('/categories');
 }