Exemplo n.º 1
0
 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(Request $request, $id)
 {
     $post = Post::findOrFail($id);
     $post->title = $request->get('title');
     $post->body = $request->get('body');
     $post->save();
     return redirect()->route('post_show_path', $post->id);
 }
Exemplo n.º 2
0
 /**
  * @param $id
  * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
  */
 public function show($id)
 {
     $post = Post::findOrFail($id);
     return view('post', ['post' => $post]);
 }