-
- 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();
- }
+
+ /**
+ * Delete a comment from the system.
+ * @param Comment $comment
+ * @return mixed
+ */
+ public function delete($comment)
+ {
+ return $comment->delete();
+ }
+
+ /**
+ * Get the next local ID relative to the linked entity.
+ * @param Entity $entity
+ * @return int
+ */
+ protected function getNextLocalId(Entity $entity)
+ {
+ $comments = $entity->comments(false)->orderBy('local_id', 'desc')->first();
+ if ($comments === null) {
+ return 1;
+ }
+ return $comments->local_id + 1;