diff --git a/app/Http/Controllers/Fo/StaticPageController.php b/app/Http/Controllers/Fo/StaticPageController.php index 3ea2e21..6a32ef2 100644 --- a/app/Http/Controllers/Fo/StaticPageController.php +++ b/app/Http/Controllers/Fo/StaticPageController.php @@ -33,12 +33,12 @@ class StaticPageController extends Controller /** * Display a static page * - * @param \Illuminate\Http\Request $request * @param \App\Models\Site\StaticPage $static_page_front + * @param \Illuminate\Http\Request $request * @return \Illuminate\Contracts\View\View|\Illuminate\Contracts\View\Factory * @throws \RuntimeException If the static page type is not handled. */ - public function displayStaticPage(Request $request, StaticPage $static_page_front) + public function displayStaticPage(StaticPage $static_page_front, Request $request) { $static_page = $static_page_front; switch ($static_page->type) { @@ -53,7 +53,10 @@ class StaticPageController extends Controller return view('theme::pages.static-page', compact('static_page')); case StaticPageType::crud(): default: - throw new \RuntimeException("Unhandled static page {$static_page->type->label}"); + if (\config('app.debug')) { + throw new \RuntimeException("Unhandled static page {$static_page->type->label}"); + } + \abort(404); } } @@ -67,7 +70,10 @@ class StaticPageController extends Controller public function displayCrudStaticPage(StaticPage $static_page) { if (!$static_page->type->equals(StaticPageType::crud())) { - throw new \RuntimeException("Unhandled static page {$static_page->type->label}"); + if (\config('app.debug')) { + throw new \RuntimeException("Unhandled static page {$static_page->type->label}"); + } + \abort(404); } return view('theme::pages.static-page', compact('static_page')); }