From 019a59ecbcaa5c7f40c1e1a3578cdbb4de6915a4 Mon Sep 17 00:00:00 2001 From: Samuel Asor <8720569+sammyskills@users.noreply.github.com> Date: Thu, 10 Aug 2023 01:22:51 +0100 Subject: [PATCH 1/2] Used default methods instead of custom methods --- user_guide_src/source/outgoing/view_cells/018.php | 2 +- user_guide_src/source/outgoing/view_cells/019.php | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/user_guide_src/source/outgoing/view_cells/018.php b/user_guide_src/source/outgoing/view_cells/018.php index 8fc2a4c5b6ae..a369c49387e8 100644 --- a/user_guide_src/source/outgoing/view_cells/018.php +++ b/user_guide_src/source/outgoing/view_cells/018.php @@ -10,6 +10,6 @@ class RecentPostsCell extends Cell public function mount() { - $this->posts = model('PostModel')->getRecent(); + $this->posts = model('PostModel')->orderBy('created_at', 'DESC')->findAll(); } } diff --git a/user_guide_src/source/outgoing/view_cells/019.php b/user_guide_src/source/outgoing/view_cells/019.php index 2ed71e348e29..58d0b8aaa439 100644 --- a/user_guide_src/source/outgoing/view_cells/019.php +++ b/user_guide_src/source/outgoing/view_cells/019.php @@ -17,6 +17,7 @@ public function mount(?int $categoryId) $categoryId, static fn ($query, $categoryId) => $query->where('category_id', $categoryId) ) - ->getRecent(); + ->orderBy('created_at', 'DESC') + ->findAll(); } } From e1b859995927046c267e6aef65dfa63357f2e58a Mon Sep 17 00:00:00 2001 From: Samuel Asor <8720569+sammyskills@users.noreply.github.com> Date: Thu, 10 Aug 2023 01:51:52 +0100 Subject: [PATCH 2/2] Added limit --- user_guide_src/source/outgoing/view_cells/018.php | 2 +- user_guide_src/source/outgoing/view_cells/019.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/user_guide_src/source/outgoing/view_cells/018.php b/user_guide_src/source/outgoing/view_cells/018.php index a369c49387e8..3f64e68464e9 100644 --- a/user_guide_src/source/outgoing/view_cells/018.php +++ b/user_guide_src/source/outgoing/view_cells/018.php @@ -10,6 +10,6 @@ class RecentPostsCell extends Cell public function mount() { - $this->posts = model('PostModel')->orderBy('created_at', 'DESC')->findAll(); + $this->posts = model('PostModel')->orderBy('created_at', 'DESC')->findAll(10); } } diff --git a/user_guide_src/source/outgoing/view_cells/019.php b/user_guide_src/source/outgoing/view_cells/019.php index 58d0b8aaa439..df78ab0acec5 100644 --- a/user_guide_src/source/outgoing/view_cells/019.php +++ b/user_guide_src/source/outgoing/view_cells/019.php @@ -18,6 +18,6 @@ public function mount(?int $categoryId) static fn ($query, $categoryId) => $query->where('category_id', $categoryId) ) ->orderBy('created_at', 'DESC') - ->findAll(); + ->findAll(10); } }