/**
  * @param Request      $request
  * @param Post         $post
  * @param Comment|null $parent
  *
  * @return \Illuminate\Http\JsonResponse
  */
 protected function createCommentFromRequest(Request $request, Post $post, Comment $parent = null)
 {
     $this->requireAuthentication();
     $this->validate($request, ['comment' => 'required']);
     $parentCommentId = $parent ? $parent->id : null;
     $depth = $parent ? $parent->depth + 1 : 0;
     $comment = new Comment(['postId' => $post->id, 'userId' => $this->user->id, 'parentCommentId' => $parentCommentId, 'depth' => $depth, 'comment' => $request->input('comment')]);
     $comment->save();
     $comment = $comment->fresh();
     return $this->response(['comment' => $comment]);
 }