$comment->parent_id = $parent_id;
$entity->comments()->save($comment);
- ActivityService::addForEntity($entity, ActivityType::COMMENTED_ON);
+ ActivityService::add(ActivityType::COMMENTED_ON, $entity);
return $comment;
}
/**
* Delete a comment from the system.
*/
- public function delete(Comment $comment)
+ public function delete(Comment $comment): void
{
$comment->delete();
}
/**
- * Convert the given comment markdown text to HTML.
+ * Convert the given comment Markdown to HTML.
*/
public function commentToHtml(string $commentText): string
{
*/
protected function getNextLocalId(Entity $entity): int
{
- $comments = $entity->comments(false)->orderBy('local_id', 'desc')->first();
+ /** @var Comment $comment */
+ $comment = $entity->comments(false)->orderBy('local_id', 'desc')->first();
- return ($comments->local_id ?? 0) + 1;
+ return ($comment->local_id ?? 0) + 1;
}
}