So I'm creating an LMS where there are admins and students. Students are only registered through admin and they can't register themselves. I was wondering if creating users table for the admins and creating another table for the students and then creating a multi-auth login system OR using users table for both admins and students and have a column with the name of 'student_profile_id' which links to the 'student_profile' table which will have the student info and then by that I can get all admin users by checking if 'student_profile_id' is null. Also, admins will have different permissions. Let me also know if there is a better structure.
You can create status of user and set it whether user is admin or not. You can handle this with middlewares.
Using Policies and Gates is a bit difficult with having a different guard in your case you want admin as a second guard. You can create queryScopes for your assistance.
Thank you for your reply. I was also wondering if I should have the 'users' table have the 'student_profile_id' column or the 'student_profiles' table have a column of 'user_id'? Is there any difference anyways?
@Sinnbeck But wouldn't it be a slower query when getting all student users i.e? As you would have to check if each user has a relationship or not instead of just checking if the column is null or not
@ahmedsobhy You can still have a is_student column on the users table. That way it is also possible to create a new student, and have them fill in their profile after.