throw runtime error with static pages only if debug
This commit is contained in:
parent
dab6f5aa0e
commit
4a3ebac562
1 changed files with 10 additions and 4 deletions
|
|
@ -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'));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue