Download the PHP package iamkevinmckee/single-database-tenancy without Composer
On this page you can find all versions of the php package iamkevinmckee/single-database-tenancy. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download iamkevinmckee/single-database-tenancy
More information about iamkevinmckee/single-database-tenancy
Files in iamkevinmckee/single-database-tenancy
Package single-database-tenancy
Short Description A simple package to create multi-tenant applications with a single database.
License MIT
Homepage https://github.com/iamkevinmckee/single-database-tenancy
Informations about the package single-database-tenancy
Single Database Multi Tenancy for Laravel
This is a package to help you create a multi-tenant application in Laravel with a single database. It is best used at the beginning of a new project.
Installation
You can install the package via composer:
Usage
After installing the package, you will need to create a Tenant model.
You will also need to add a tenant_id
to your users
table.
Next you will want to publish the stubs. This will ensure every subsequent model has a migration with a tenant_id
. For this to work, you must create your models with the -m
flag so a migration is also created with the model.
At this point, you just need to make sure each User has a tenant_id assigned to them when they register and all Eloquent operations will be scoped to the tenant.
When inserting data into the database via Eloquent, the tenant_id
will automatically be set to the tenant_id
of the user submitting the data.
Testing
Changelog
Please see CHANGELOG for more information what has changed recently.
Contributing
Please open an issue before submitting a PR to ensure the feature will be accepted.
Security
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
Credits
- Kevin McKee
- All Contributors
License
The MIT License (MIT). Please see License File for more information.
Laravel Package Boilerplate
This package was generated using the Laravel Package Boilerplate.