public function commentToClassX(Request $request)
 {
     onlyAllowPostRequest($request);
     $all = $request->only(['post_id', 'author_id', 'content']);
     $comment = Comment::create(['post' => intval($all['post_id']), 'author' => intval($all['author_id']), 'content' => $all['content']]);
     $c = Comment::getCommentInfoById($comment->id);
     return response()->json($c);
 }
 /**
  * Get list comment by post_id
  *
  * @param $post_id
  *
  * @return null
  */
 public static function getCommentsByPostId($post_id)
 {
     $comments = Comment::all()->where('post', intval($post_id));
     if ($comments->count() == 0) {
         return [];
     }
     $listComments = [];
     foreach ($comments as $comment) {
         $listComments[] = Comment::getCommentInfoById($comment->id);
     }
     return $listComments;
 }
 public function comment(Request $request)
 {
     onlyAllowPostRequest($request);
     $all = $request->only(['post', 'author', 'content']);
     $comment = Comment::create(['post' => intval($all['post']), 'author' => intval($all['author']), 'content' => $all['content']]);
     $c = Comment::getCommentInfoById($comment->id);
     /**
      * Dữ liệu trả về
      */
     $response = new stdClass();
     $response->error = false;
     $response->comment = $c;
     return response()->json($response);
 }