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

sakaye87's avatar

Database Setup - Roles/Permissions

Hello, I'm working on a project for a school where I need to have a users table that will have staff and students. I am setting up roles and permissions for the staff to have access evaluation tools. I also need to store additional information specific to each student. What is the best way to set up my database structure to include this information?

0 likes
3 replies
TheNodi's avatar
TheNodi
Best Answer
Level 11

The role of the user can be saved as a "role" column in the "users" table, I personally would choose a enum field. The permissions are really easy to declare with Laravel, see Authorization:

$gate->define('evaluation-tools', function ($user) {
    return $user->role == 'teacher';
});

Which kind of information do you have to store about the students?

You can go with another table, like "students_info", and set a one-to-one relationship.

sakaye87's avatar

Thanks @TheNodi. I like your approach to my problem. None of my users will ever have more than 1 role so saving it on the users table should work and a separate table for additional student information is good too.

Please or to participate in this conversation.