简体   繁体   中英

Multi-Tenancy , multi database Laravel management best practice

I am looking towards building a multi-tenant Laravel app which is a school management system that has one code-base but has multiple databases for each school. This system will have 800 schools (tenants), and each school will have its own users (teachers and students).

How can I implement the above with Laravel? Can or should I use a package or the is laravel native implementation of the above?

Every time a school is registered, how can I automatically create a subdomain on a domain, and automatically load the new tenant on AWS EBS or Heroku

How can I run one migration to all multiple databases?

yes, you can do it by declaring multiple database connections in your config file and the set connection dynamically in each fetch queries and also migration queries.

in normal queries:

DB::connection('some dynamic connection name')->...

or in migrations:

Schema::connection('connection name')->....

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM