X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/919660678bec2b94eaa84ac60d0313f5ef07dfb7..refs/pull/1462/head:/app/Actions/ActivityService.php diff --git a/app/Actions/ActivityService.php b/app/Actions/ActivityService.php index 7b1046d22..f4f82a6f4 100644 --- a/app/Actions/ActivityService.php +++ b/app/Actions/ActivityService.php @@ -1,6 +1,5 @@ isA('book')) { $query = $this->activity->where('book_id', '=', $entity->id); } else { - $query = $this->activity->where('entity_type', '=', get_class($entity)) + $query = $this->activity->where('entity_type', '=', $entity->getMorphClass()) ->where('entity_id', '=', $entity->id); } $activity = $this->permissionService ->filterRestrictedEntityRelations($query, 'activities', 'entity_id', 'entity_type') - ->orderBy('created_at', 'desc')->with(['entity', 'user.avatar'])->skip($count * $page)->take($count)->get(); + ->orderBy('created_at', 'desc') + ->with(['entity', 'user.avatar']) + ->skip($count * ($page - 1)) + ->take($count) + ->get(); return $this->filterSimilar($activity); }