- Framework: Laravel 8.x
I'm attempting to use custom error pages. These are located in the default location: /resources/views/errors/...
.
These load as expected. However, they extend the base view template. This template uses the auth()->user()
functionality to make decisions on visible menus.
The auth()->user()
does not work on the error views. Note that it works as expected on other views.
How do I load the authenticated user for these error file views?
Thanks in advance.
CodePudding user response:
Add this at the end of your route file for 404 error. Usually 404 doesn't get the session.
Route::fallback(function () {
return abort(404);
});