I have a Laravel project that currently has users who are all Doctors. I would like other types of user like Teachers, Policemen, etc. to use the site. This requires me to have different roles, which is not an issue. The issue is each type of role requires different user information in the Users table. (e.g for Doctors I need to save their qualifications, speciality, etc while for Policemen I want to save their years of service, rank, title, etc.).
All these people need to use the Users table so that they are able to login. I would like to know what is the best way to achieve this.
What I have tried:
- One Users table with basic fields (name, email, address, phone), then
created additional tables with the additional fields for each user
type (i.e. created Doctors table with 'speciality',
'qualifications', etc. fields) and then linked each Doctors instance to a User using user_id. Same thing for Teachers, Policemen, etc. The problem here is that I cannot get all the information I require of the user once their logged in. (i.e If I need to pull the years of service for the person who is logged in, I can't (or can I?) because that information is in a different table. - Multiple tables (Policemen table, Doctors table, etc). With this, I can get the tables to have all the information I need but the issue with this is I cant use all the different tables to log the users in (or can I?)
- One User table with all fields for all types of users. User registers with email, password and role and then fills in the fields relevant to them once their role has been determined. The issue with this is that the Users table then has too many columns.
I may be missing something very obvious but someone please help me with best practice here or what is the most logical approach?