Several types of accounts, how best to organize at the level of the table/migrations?

I have an app where you will signup different types of accounts.
The three main types are — customer, performer, admin.

The customer can create an account for your Manager. Just show the approximate structure:

1. The customer;
1. Manager;
2. The contractor
3. Administrator
1. Content Manager
2. Auditor

The main three types of accounts, some of them can create other accounts.
Here it is immediately clear that we need parmesani and roles, I will use laravel spatie, accesses can be done by role, parmesana, that's not the problem.

How about the fact that the fields of the table will be different in any different types of accounts (customer, contractor, auditor)? For example, the customer will have fields like name of organization, category of activity, type of company, and so on. And by their fields like price range (how much is an hour of work for example), and all what is not the table of the customer. And so with other roles. At the table level (or entities/logic) how do I best implement this?

Don't make the same different table, like AdminUser, ManagerUser, and so on.
April 3rd 20 at 18:29
3 answers
April 3rd 20 at 18:31
I, in such cases, in the table the user can stand only with regard to authorization. And all the additional fields I stand in a table profile_*. In your case profile_admin, profile_manager , etc.
April 3rd 20 at 18:33
@Kaylee use the "table input" (do not know as it correctly is called)
The point is that you have a separate table which stores the fields and values that are tied to the profile, and you don't need to add a bunch of fields in a specific table with profiles.

profile_id | name | value

well and accordingly build links, and all the problem is solved
Ie correctly understood that I can make a base class where the common User for all the accounts fields (all that for authorization and other things), and then if you need an extension, just make the table profile_setting and add the necessary fields?
In terms of extensibility. - Kaylee commented on April 3rd 20 at 18:36
@Kaylee, Yes, that's right - Sterlin commented on April 3rd 20 at 18:39
@Kaylee, Yes, it is the right decision - Jerod_Dicki commented on April 3rd 20 at 18:42
Properly, this is called EAV. - Juwan commented on April 3rd 20 at 18:45
April 3rd 20 at 18:35
Use MongoDb and you will be happy.
@deshaun.Nitzsche why would he then Mongo ? - Jerod_Dicki commented on April 3rd 20 at 18:38

Find more questions by tags Laravel