Skip to content

basherr/laravel-multi-tenancy-single-database

Repository files navigation

Multi Tenant Database Laravel With Orchestra Package Implementation

Note

If you are looking for Configuration Tenant Driver for Multiple Databases, Please Click here

Installation Instruction - Single Database Connection Setup

Clone or Download the Repository to the htdocs / www folder.

Update Composer by typingComposer update in the command line on the root directory of project. Change default database configuration in config/database.php
We are using mysql as default connection
'mysql' => [
            'driver' => 'mysql',
            'host' => env('DB_HOST', 'localhost'),
            'port' => env('DB_PORT', '3306'),
            'database' => env('DB_DATABASE', 'forge'), //This database will be the root for all other databases, can manage other databases tables etc
            'username' => env('DB_USERNAME', 'forge'),
            'password' => env('DB_PASSWORD', ''),
            'charset' => 'utf8',
            'collation' => 'utf8_unicode_ci',
            'prefix' => '',
            'strict' => false,
            'engine' => null,
        ],

We already have some Role seeder, So we also need to seed the database along with migration


Run migration by typingphp artisan migrate --seedin the command line

Tip

To create a migration for Tenantsimply type php artisan tenanti:make site create_tablename_table in the command line

The tenant migration will be under database/tenant/sites/

Contribution

Please feel free to contribute and send pull request.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published