S
S
Sanjar Tolibjonov2019-12-18 08:16:04
Laravel
Sanjar Tolibjonov, 2019-12-18 08:16:04

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

I have an application where different types of accounts will register.
There are three main types - customer, performer, admin.
The customer can create an account for his manager. I'll just show you an approximate structure:
1. Customer;
1. Manager;
2. Performer
3. Administrator
1. Content manager
2. Auditor
There are three main types of accounts, some of them can create other accounts.
Here it is immediately clear that permissions and roles are needed, I will use laravel spatie, accesses can be done by roles, permissions, this is not the problem.
How to deal with the fact that the fields of the table will be different in any way for different types of accounts (customer, performer, auditor)? For example, a customer would have fields like organization name, activity category, company type, and so on. And the performer has his own fields like a price range (how much does an hour of work cost, for example), and all that the customer’s table does not have. And so it is with other roles. At the table (or entity/logic) level, what is the best way for me to implement this?
Do not make different tables like AdminUser, ManagerUser, and so on.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
L
Lander, 2019-12-18
@koshagoool

I, in similar cases, in the table userI take out only that as to authorization. And I take out all additional fields in tables profile_*. In your case profile_admin, profile_manageretc.

O
Oleg Frolov, 2019-12-18
@Digiport

Use MongoDb and be happy.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question