Пример #1
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update($id)
 {
     if (Request::isMethod("get")) {
         # code...
         $resep = Resep::find($id);
         $bahans = Bahan::get();
         return view('resep.update', compact('bahans', 'resep'));
     } elseif (Request::isMethod('post')) {
         # code...
         $resep = Resep::findOrFail($id);
         $resep->update(Input::all());
         $newBahanIds = Input::get('bahan_ids');
         $resep->bahan()->sync($newBahanIds);
         return redirect('resep/detail/' . $resep->id);
     }
 }
Пример #2
0
 public function detail($id)
 {
     $item = Resep::findOrFail($id);
     return view('resep.detail', compact('item'));
 }