Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

chriss39's avatar

Adding user roles to built in auth

I am fairly new and still learning Laravel but I have a question before I dive into my next project on how I should setup proper authentication. I will have 3 different user roles (super admin, client and user).

So I will have an admin section where clients will be able to see information about their users (client_user). I will also have an admin section where the super_admin can pretty much see anything they want. Lastly I will have the regular sections of the site where users will be able to see. My plan to do this is to setup a table for user roles as each user will only have one role so no pivot needed. Then create 2 different user registration pages. One for clients and one for users. With this assumption I think it would be best to keep all users in the same table and just add a column for user_role. On each registration page there would be some different inputs that will be required. My assumption is should I just edit the existing authcontroller which seems pretty straight forward.

My question then becomes how to I control access to certain areas based on roles.

Lastly I have seen some packages available such as Entrust but I think it may be overkill for what I am looking at. Just also thinking it would be good learning opportunity to code it myself.

Just looking for advice to head me down the right path.

Thanks

0 likes
1 reply
jlrdw's avatar

You can add a roles field to the user table and watch the videos also study the documentation on gate. By the way some of the introductory videos to this subject are free I just watched one on gate last night absolutely free some very interesting stuff. I am still trying to get all of this understood also.

Please or to participate in this conversation.