From bd594f0ff80e9b827f5a906c4da5963eb9b5c4b4 Mon Sep 17 00:00:00 2001 From: Caen De Silva Date: Sat, 7 Jan 2023 18:11:46 +0100 Subject: [PATCH] Replace internal settings state to only contain pageSize integer See https://github.com/hydephp/develop/pull/814#issuecomment-1374541989 --- .../Framework/Features/Publications/PaginationService.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/framework/src/Framework/Features/Publications/PaginationService.php b/packages/framework/src/Framework/Features/Publications/PaginationService.php index bf1be44ad36..d589cbbbcbb 100644 --- a/packages/framework/src/Framework/Features/Publications/PaginationService.php +++ b/packages/framework/src/Framework/Features/Publications/PaginationService.php @@ -28,7 +28,7 @@ */ class PaginationService { - protected PaginationSettings $paginationSettings; + protected int $pageSize = 25; protected Collection $chunks; @@ -41,7 +41,7 @@ class PaginationService public function __construct(Arrayable|array $items = [], PaginationSettings|array $paginationSettings = [], int $currentPageNumber = null, string $paginationRouteBasename = null) { - $this->paginationSettings = $this->getPaginationSettings($paginationSettings); + $this->pageSize = $this->getPaginationSettings($paginationSettings)->pageSize; $this->generate(collect($items)); @@ -106,7 +106,7 @@ public function totalPages(): int /** The number of items to be shown per page. */ public function perPage(): int { - return $this->paginationSettings->pageSize; + return $this->pageSize; } /** Determine the total number of matching items in the data store. */