示例#1
0
 public function createComment(CommentRequest $req)
 {
     $comment = new Comment();
     $comment->name = $req->input('name');
     $comment->email = $req->input('email');
     $comment->body = $req->input('comment');
     $comment->reply_id = $req->input('reply');
     $post = Post::findorFail($req->input('post_id'));
     $post->comments()->save($comment);
     return redirect()->back();
 }