コード例 #1
0
 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update(Request $request, $id)
 {
     // Store updated Comment in the database
     $comment = Comment::findOrNew($id);
     $comment->title = $request->input('title');
     // or $request->only('title', 'body');
     $comment->body = $request->input('body');
     $comment->save();
     // Initialise view parameters
     $params = ['title' => 'Updated Blog Comment', 'comment' => $comment];
     // Return the rendered view
     return view('blog.comment.update', $params);
 }
コード例 #2
0
 /**
  * Display the specified resource.
  *
  * @param CommentRequest  $request
  * @return Response
  */
 public function show(CommentRequest $request)
 {
     Comment::findOrNew($request->input('id'));
     return response()->json(['success' => true]);
 }