2017 © Pedro Peláez
 

library multi-tenant

MultiTenant package / one application with multi databases schema

image

mhnassar/multi-tenant

MultiTenant package / one application with multi databases schema

  • Sunday, November 19, 2017
  • by MHNassar
  • Repository
  • 3 Watchers
  • 7 Stars
  • 1 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 4 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

multiTenant

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)

Advantages

  • Very simple
  • Seperated Database Schema

Installation

  • Add in composer.json
"mhnassar/multi-tenant": "dev-master"
  • Run ```bash composer update
- Add  in config/app.php 
 ```bash
 'providers' => [
        ...
        MHNassar\MultiTenant\MultiTenantServiceProvider::class,
        ],
  • let’s add middleware to the array of middleware in file Http/Kernel.php: ```bash protected $middleware = [ ...... MHNassar\MultiTenant\Middleware\MultiTenant::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,
        ],

  • change "APP_ENV" in .env file to "local"
  • To run migration and seeds run the "Multi:migrate" command with the name of your subdomain from the main folder:
php artisan Multi:migrate tenant1

Now you are finished ... Enjoy!, (*2)

ToDo List

  • wizard intallation
  • Dashboard to mange Tenates

The Versions

19/11 2017

dev-master

9999999-dev

MultiTenant package / one application with multi databases schema

  Sources   Download

MIT

by Mahmoud Nassar

schema databases multi multitenant multi database