lundi 25 mars 2019

Laravel guest middleware

I have a page in my web app that should be blocked from logged in users. Similar to how a login or register page should not be accessible to already logged in users. I accomplished this by using guest middleware in controller constructor.

$this->middleware("guest")->only("page_action"); // like this

In this setup, if logged in user tries to visit that page they get redirected to home page. But I need to show a 404 not found page instead of redirecting. How can I do that?

In short, how can I make a page accessible to guest only and make it look like it does not exist to logged in users?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire