/** * @param $id * * @return mixed */ public function article_comments($id) { $comments = ArticleComment::whereArticleId($id)->orderBy('created_at', 'desc')->get(); return $comments; }
/** * Get the comments of an article detail * * @return array */ protected function _getArticleCommentsNumber() { if ($this->article->count() == 0) { return array(); } $articleCommentCount = array(); foreach ($this->article as $comment) { $articleCommentCount[$comment->id] = ArticleComment::whereArticleId($comment->id)->whereApproved('1')->count(); } return $articleCommentCount; }