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

kramsuiluj's avatar

A system with several user roles.

I'm making a system with user roles like admin, teacher and student, but I don't know how to approach it yet. I just finished the laravel 8 from scratch series. I need some idea because its still confusing for me.

I was thinking that I can put them all in one table like Users table for example since they're all users, but I was wondering if its ok to do it like that since they would all have different columns, a student would have Grade column for instance but the admin and teacher won't need that.

So I thought it would be better if they have their own respective tables then that would allow me to set relationships since I would have to do it for teacher and student. But still I have no idea if this is the right way.

I haven't started the development yet. I only have a little idea about the roles and permissions part. I would appreciate any help, thanks!

0 likes
7 replies
kramsuiluj's avatar

@Sinnbeck So, basically I could use multiple models, then I could simply set any role I want on any model instance? does that make sense?

Sinnbeck's avatar

@kramsuiluj I would suggest to just use it on the user model and just have different roles for different permissions.

kramsuiluj's avatar

@Sinnbeck I see, but how do you address the part where each role has a different set of columns? Is it fine just to leave it empty if its not for the specific user role?

kramsuiluj's avatar

@Snapey Interesting, thanks a lot! I'll give it a shot and I'll just follow up with some questions if I have any.

Please or to participate in this conversation.