Summer Sale! All accounts are 50% off this week.

jgomez90's avatar

Require login for certain views?

Hi there,

I am building a small cms like application as a personal project and I'm wondering how can I get certain views to be 'authenicated' or password protected? For example, I ran the auth command and I have the dashboard routing to '/admin'.

I want to create a view with a form to post events so that route is /admin/events

If I was to hit that view directly with incognito mode it'll still load so I want it where if I someone was to access it by random it'll redirect them to the /login url to login. I do have plans for an events section as well. Let me know if there's more clarification needed.

0 likes
3 replies
beracah.kings's avatar

Did you implement the auth middle ware in your admin controller. you can leave out views by using except in the construct of the controller

Please or to participate in this conversation.