Download the PHP package rndwiga/laravel-multi-db-tenant without Composer
On this page you can find all versions of the php package rndwiga/laravel-multi-db-tenant. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download rndwiga/laravel-multi-db-tenant
More information about rndwiga/laravel-multi-db-tenant
Files in rndwiga/laravel-multi-db-tenant
Package laravel-multi-db-tenant
Short Description This package is used to create and manage laravel multitenant applications
License MIT
Informations about the package laravel-multi-db-tenant
Multi-Database Tenant Package for Laravel
This package is meant for Laravel applications to help with Multi-Database Tenant Applications.
A sample laravel application that uses this package can be found at github
Installation
Add the service providers to your application providers array in config/app.php A Facade is also available and can be added...
Providers
Facade
Configuration Files
This will copy the laramultidbtenant.php configuration file into the app/config directory as well as copy the tenant, tenant_users and tenant_databases migration files needed. Create your models.
Setup the database for your Tenants in your .env files
Create the needed model classes
This will create the Tenant, TenantDatabase, TenantUser models. Make sure to provide the right relationships and don't forget to create the relationships within the User, Tenant, TenantUser and TenantDatabase models as well as set the connection properties.
Create the template, tenant migration folders as well as a tenant public folder
This package registers a middleware called authTenant within it's service provider. This is needed in order to automatically set the default connections for the Application's model
For a todo application see demo application
Inside your controllers that will control tenant specific routing, add the following to the __construct methods
also make sure to include the trait to do migrations automatically once the tenant has registered their company...
Complete namespace for this is...
Create your migration files
This assumes you have already done...
So create your migration files...
Your TenantDatabase Model
This is important
Your TenantDatabase model must implement the ITenantDatabase interface
Once that's done, start with registering a user, at least collect information needed. In your controller that registers the user, tenant, tenant_database, tenant_users you should be able to do...
Use this demo as a guide. See SessionsController@postRegister. This should show the code...
Questions
Twitter: @rndwiga254
Future
- Do some clean up of the code.
- Command for creating template and tenant migration files
- Command to migrate to template database
- Command to sync new migration files
- Command to copy any needed data from template database to all tenant databases
- Add tests
All versions of laravel-multi-db-tenant with dependencies
illuminate/support Version ^5.3
illuminate/console Version ^5.3
illuminate/config Version ^5.3
vlucas/phpdotenv Version ^2.4
illuminate/database Version ^5.3
illuminate/session Version ^5.3
illuminate/auth Version ^5.3