vendredi 6 janvier 2017

Laravel 5.3: Use auth/middleware on custom error page

The problem

When displaying HTTP error pages (404, 500 and so on), I want to keep the standard design of my current project, including header and footer. My project also includes a registration system. When a user is logged in and receives an error message, he will be redirected to the corresponding error page, but Laravel does not recognize that the user is logged in. That's because custom error pages (located in resources/views/errors/{code}blade.php don't run through the normal web middleware (for some reasons).

This behavior was already reported a few times, but no sufficient answer was provided. A hacked solution was to set the StartSession middleware to be run on every request, but this isn't sufficient for my case.

How can I use the Auth/Session middleware on custom error pages anyway?

Solutions that do not fit

  • I don't want to add the StartSession middleware (or any other) to every request

Related questions



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2i2lMTT
via IFTTT

Aucun commentaire:

Enregistrer un commentaire