1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-07-30 04:23:11 +03:00

#47 - Adds functionality to display child comments. Also has some code towards the reply functionality.

This commit is contained in:
Abijeet
2017-04-27 02:35:29 +05:30
parent d447355a61
commit c3ea0d333e
12 changed files with 127 additions and 34 deletions

View File

@ -38,14 +38,13 @@ class CommentRepo {
return $comment;
}
public function getCommentsForPage($pageId, $commentId, $count = 20) {
if (empty($commentId)) {
// requesting parent comments
$query = $this->comment->getParentCommentsByPage($pageId);
return $query->paginate($count);
} else {
// requesting the child comments.
return Comment::whereRaw("page_id = $pageId AND parent_id = $commentId")->get();
}
public function getCommentsForPage($pageId, $commentId, $count = 20) {
// requesting parent comments
$query = $this->comment->getCommentsByPage($pageId, $commentId);
return $query->paginate($count);
}
public function getCommentCount($pageId) {
return $this->comment->where('page_id', '=', $pageId)->count();
}
}