mercredi 2 décembre 2015

Laravel 5.1: using default Auth middleware globally

I'm trying to use the out-of-box Authenticate middleware globally except on auth/login and auth/logout, so that I don't need to add it in every single controller. I added it to the global middleware list in Kernel; however, it gets stuck in an infinite auth/login redirect. For any guest, I want the page to be redirected to auth/login and stay there.

It's happening because when it hits auth/login the first time, the global Authenticate kicks in and redirects to auth/login again over and over.

Is it possible to use the default Authenticate middleware globally as I've described? Do I need to create a new middleware for it?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire