php - How to have a multi tenant database in laravel where every tenant has multiple users? -


so trying understand how multi tenant database approach works confused in places. trying use in laravel , mysql

i understand can have databases each tenant in application when user logs in, can check tenant , change db connection use database. guessing how works.

but here start confused. tenant logs application able create users , assign them roles means there super admin creates tenants there super admin particular tenant creates users instance of tenant itself.

so how authenticate users in such situation. example, can authenticate tenant , change db connection appropriate database have log in user of particular tenant , how keep 2 enitities logged in @ same time in session?

i guessing multi auth package (like multi auth) might in doing since new blurry.

i hopping has encountered problem , might able me.

first i'll assume have strong reason having multiple databases rather allowing of users live in same tables. because have particularly data heavy application, security situation, or want able separate out client data in application such crm.

second, if use multiple databases, still rely on laravel controlling access database. laravel use administrative level credentials in queries, within application laravel's auth layer control access specific routes , actions.


Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -