/** * Returns the top 3 levels of comments on a post. * * @param Post $post * * @return Comment[] */ public function getPostCommentsWithReplies(Post $post) { $comments = $post->comments()->where('depth', '<=', 2)->orderBy('depth', 'ASC')->orderBy('likeCount', 'DESC')->orderBy('createdAt', 'ASC')->get()->getDictionary(); //Get a dictionary keyed by primary keys return $this->sortCommentReplies($comments); }