mercredi 27 septembre 2017

Conditionally require authentication to access route in Laravel 5.4

In Laravel 5.4 I have a Page model and I would like to add a new field in DB to conditionally require authentication to browse the page.

So basically I want to serve pages, some pages will be accessible to everybody and some pages will require the user to be authenticated. If the user needs to be authenticated to view the page, he then will be redirected to the login page.

How can I implement this in Laravel?

I am thinking Gate but i am unsure how to mix both unauthenticated and authenticated rules..

Thanks guys!



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

Aucun commentaire:

Enregistrer un commentaire