Wallogit.com
2017 © Pedro Peláez
MultiTenant package / one application with multi databases schema
Laravel package to handel multi databases in one sorce code , depend on sub domain . Suitable for marketing companies that like to re-use functionality for different clients or start-ups building the next software as a service., (*1)
"mhnassar/multi-tenant": "dev-master"
- Add in config/app.php
```bash
'providers' => [
...
MHNassar\MultiTenant\MultiTenantServiceProvider::class,
],
After going through all the previous steps, your package should be installed successfully.
# Configuration Tenant Driver for Multiple Database
- Create a new subdomain for your domain in your hosting server (e.g.: tenant1.example.com)
- Create a new database with the same name of your subdomain (e.g. tenant1)-
- Create a new database connection with the same name of your subdomain in the file config/database.php:
```bash
'tenant1' => [
'driver' => 'mysql',
'host' => env('DB_HOST', 'localhost'),
'port' => env('DB_PORT', '3306'),
'database' => 'tenant1', //name of database
'username' => 'root',
'password' => 'root',
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
'strict' => true,
'engine' => null,
],
php artisan Multi:migrate tenant1
Now you are finished ... Enjoy!, (*2)