From a1a9a8f5d8a569c381b874c8dacbc93a2ca41faf Mon Sep 17 00:00:00 2001 From: Bastian Allgeier Date: Fri, 13 Dec 2024 11:56:18 +0100 Subject: [PATCH] Use new models & modelsPaginated distinction to get access to both --- config/sections/files.php | 11 ++++++----- config/sections/pages.php | 11 ++++++----- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/config/sections/files.php b/config/sections/files.php index ef2c103073..e2d48a8034 100644 --- a/config/sections/files.php +++ b/config/sections/files.php @@ -91,14 +91,15 @@ $files = $files->flip(); } + return $files; + }, + 'modelsPaginated' => function () { // apply the default pagination - $files = $files->paginate([ + return $this->models()->paginate([ 'page' => $this->page, 'limit' => $this->limit, 'method' => 'none' // the page is manually provided ]); - - return $files; }, 'files' => function () { return $this->models; @@ -110,7 +111,7 @@ // a different parent model $dragTextAbsolute = $this->model->is($this->parent) === false; - foreach ($this->models as $file) { + foreach ($this->modelsPaginated() as $file) { $panel = $file->panel(); $permissions = $file->permissions(); @@ -145,7 +146,7 @@ return $data; }, 'total' => function () { - return $this->models->pagination()->total(); + return $this->models()->count(); }, 'errors' => function () { $errors = []; diff --git a/config/sections/pages.php b/config/sections/pages.php index e53a577a39..bdbd61346a 100644 --- a/config/sections/pages.php +++ b/config/sections/pages.php @@ -150,25 +150,26 @@ $pages = $pages->flip(); } + return $pages; + }, + 'modelsPaginated' => function () { // pagination - $pages = $pages->paginate([ + return $this->models()->paginate([ 'page' => $this->page, 'limit' => $this->limit, 'method' => 'none' // the page is manually provided ]); - - return $pages; }, 'pages' => function () { return $this->models; }, 'total' => function () { - return $this->models->pagination()->total(); + return $this->models()->count(); }, 'data' => function () { $data = []; - foreach ($this->models as $page) { + foreach ($this->modelsPaginated() as $page) { $panel = $page->panel(); $permissions = $page->permissions();