I am wanting to have a catch all route for catching any page that's isn't loaded. I have tried a couple of ways.
First way - I have created a seperate Service Provider and loaded it last in the config.
Second attempt was to intercept 404's
render
method in Handler.php
if($exception instanceof NotFoundHttpException)
return PageController::handleMissingPage();
Then the handleMissingPage()
method
$slug = '/';
if(strlen($path) > 1)
$slug = ltrim($path, '/');
if ($page = Page::where('path', $slug)->first())
return response()
->view($page->template, ['pageBuilder' => $page], 200);
abort(404);
This second way works, but it doesn't feel correct intercepting 404's. The user is also never seen as logged in doing it this way
I'm stuck as to what to try next, I assumed loading it in last would give it last priority