$comment->parent_id = $parent_id;
$entity->comments()->save($comment);
- ActivityService::addForEntity($entity, ActivityType::COMMENTED_ON);
+ ActivityService::add(ActivityType::COMMENTED_ON, $entity);
return $comment;
}
*/
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;
}
}