- public function getCommentCount($pageId) {
- return $this->comment->where('page_id', '=', $pageId)->count();
+ /**
+ * 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;