Multiple authenticatable / notifiable models or one users table with many roles ?
Hello,
I have a first version of an app with many types of people :
admin, user, ... can connect to the app
trainers, students cannot connect to the app and are for the moment in trainers / students tables, that's interesting because according to the roles (trainer, student, admin, ...) I don't have the same informations to save in the database
In a new version of the app, I need to let the trainers / students connect to the app. What are the best solutions ?
is it possible to set the trainers / students tables authenticable and notifiable like the users table ? but I think that it will not be pratice to handle
is it better to migrate all people to the users table and assign roles to each type of users (admin, user, trainer, student, ...) ? I think it will probably be the easiest way
Perhaps there is many more solutions I don't think about ?
@MohamedTammam Ok so for you the best way would be to migrate all people to one table and handle the authentication in one table and then reorganize the database with this constraint.
@vincent15000 that I agree with @mohamedtammam . A user is a user. It isn't an admin.. Or a writer. It's a user. What the user can do is a role or group or similar :)
@vincent15000 each system is different and has certain specifications. For example a large Hospital chain is going to have Separate Tables for patients and the physician portal.
Humana military has user, physician, and government separate logins and tables.
And some government agencies you have to code to a spec they will tell you whether to use the same table or Separate Tables.
Imagine you want to have a profile picture for users, now you need to do it for each table and model. Imagine about payments, settings, etc. Users are users with different roles.
@vincent15000 I have tried maintaining a thing like this once. Each part had a seperate login and table. Then we started having users with multiple logins. It was a constant struggle as they changed their password in one system and assumed it worked in all. But as each login was it's own silo, that didn't work
@vincent15000 we ended up merging it all into one table. Took almost a complete week for 2 people. Time could have been saved if it had been made like that from day one
We made 1 login page and if more than 1 "role" is detected we would show a "select product" screen
@vincent15000 kinda yeah. Except we sold multiple products, each with their own routes and tables. So select product :) but it could just as well have been roles or jobs
@vincent15000 I didn't really suggest one way or the other I just said go by a specification if you have one.
An example is the Texas Department of Aging and Disability Services has separate Tables for supervisors versus employee.
Yes the supervisor is an employee but he or she logs out and having to log back in if going into a regular employee function such as a training session that all employees go through.