From 02d124ac44795da7d6bf5cbbcc3a5063d6343aff Mon Sep 17 00:00:00 2001 From: Shawn Rice Date: Tue, 24 Sep 2024 07:14:51 -0400 Subject: [PATCH] fix(pages): Only pull published pages --- app/Modules/Pages/Models/Page.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/app/Modules/Pages/Models/Page.php b/app/Modules/Pages/Models/Page.php index 6f1059b74..16de3f8ae 100644 --- a/app/Modules/Pages/Models/Page.php +++ b/app/Modules/Pages/Models/Page.php @@ -341,6 +341,17 @@ public static function stackByPath(string $path): Collection ->whereRaw('n.lft BETWEEN p.lft AND p.rgt') ->where('n.path', '=', (string) $path) ->whereNull('p.deleted_at') + ->where('p.state', '=', 1) + ->where(function ($where) + { + $where->whereNull('p.publish_up') + ->orWhere('p.publish_up', '<=', Carbon::now()->toDateTimeString()); + }) + ->where(function ($where) + { + $where->whereNull('p.publish_down') + ->orWhere('p.publish_down', '>', Carbon::now()->toDateTimeString()); + }) ->orderBy('p.lft', 'asc') ->get(); }