diff --git a/app/Nova/CsrCampaignPage.php b/app/Nova/CsrCampaignPage.php index e1debae2b..e4cc40e1c 100644 --- a/app/Nova/CsrCampaignPage.php +++ b/app/Nova/CsrCampaignPage.php @@ -34,7 +34,13 @@ public static function uriKey(): string public static function indexQuery(NovaRequest $request, $query) { - return $query->where('id', 1); + if (!\Illuminate\Support\Facades\Schema::hasTable('csr_campaign_page')) { + return $query->whereRaw('1 = 0'); + } + + $page = \App\CsrCampaignPage::config(); + + return $query->where('id', $page->id); } public static function authorizedToCreate(Request $request): bool diff --git a/app/Nova/DancePage.php b/app/Nova/DancePage.php index 39c6bd0fb..3bf2abace 100644 --- a/app/Nova/DancePage.php +++ b/app/Nova/DancePage.php @@ -33,7 +33,13 @@ public static function uriKey(): string public static function indexQuery(NovaRequest $request, $query) { - return $query->where('id', 1); + if (!\Illuminate\Support\Facades\Schema::hasTable('dance_page')) { + return $query->whereRaw('1 = 0'); + } + + $page = \App\DancePage::config(); + + return $query->where('id', $page->id); } public static function authorizedToCreate(Request $request): bool diff --git a/app/Nova/GetInvolvedPage.php b/app/Nova/GetInvolvedPage.php index 2decc8f63..8c29e4489 100644 --- a/app/Nova/GetInvolvedPage.php +++ b/app/Nova/GetInvolvedPage.php @@ -42,12 +42,24 @@ public static function authorizedToViewAny(Request $request): bool public static function indexQuery(NovaRequest $request, $query) { - return $query->where('id', 1); + if (!\Illuminate\Support\Facades\Schema::hasTable('get_involved_page')) { + return $query->whereRaw('1 = 0'); + } + + $page = \App\GetInvolvedPage::config(); + + return $query->where('id', $page->id); } public static function relatableQuery(NovaRequest $request, $query) { - return $query->where('id', 1); + if (!\Illuminate\Support\Facades\Schema::hasTable('get_involved_page')) { + return $query->whereRaw('1 = 0'); + } + + $page = \App\GetInvolvedPage::config(); + + return $query->where('id', $page->id); } public static function authorizedToCreate(Request $request): bool diff --git a/app/Nova/OnlineCoursesPage.php b/app/Nova/OnlineCoursesPage.php index 5066eaed7..885127679 100644 --- a/app/Nova/OnlineCoursesPage.php +++ b/app/Nova/OnlineCoursesPage.php @@ -33,7 +33,13 @@ public static function uriKey(): string public static function indexQuery(NovaRequest $request, $query) { - return $query->where('id', 1); + if (!\Illuminate\Support\Facades\Schema::hasTable('online_courses_page')) { + return $query->whereRaw('1 = 0'); + } + + $page = \App\OnlineCoursesPage::config(); + + return $query->where('id', $page->id); } public static function authorizedToCreate(Request $request): bool diff --git a/app/Nova/TreasureHuntPage.php b/app/Nova/TreasureHuntPage.php index 4e5711ef8..4bfa406cb 100644 --- a/app/Nova/TreasureHuntPage.php +++ b/app/Nova/TreasureHuntPage.php @@ -33,7 +33,13 @@ public static function uriKey(): string public static function indexQuery(NovaRequest $request, $query) { - return $query->where('id', 1); + if (!\Illuminate\Support\Facades\Schema::hasTable('treasure_hunt_page')) { + return $query->whereRaw('1 = 0'); + } + + $page = \App\TreasureHuntPage::config(); + + return $query->where('id', $page->id); } public static function authorizedToCreate(Request $request): bool