binarcode / laravel-tenantable
Just another multi tenant support package for Laravel.
Installs: 85 193
Dependents: 0
Suggesters: 0
Security: 0
Stars: 3
Watchers: 4
Forks: 2
Open Issues: 0
Requires
- php: ^8.1
- illuminate/contracts: ^10.0|^11.0
Requires (Dev)
- brianium/paratest: ^6.3|^7.0
- orchestra/testbench: ^8.0|^9.0
- phpunit/phpunit: ^9.3.3|^10.0|^11.0
- spatie/laravel-ray: ^1.9
- vimeo/psalm: ^4.4|^5.0|^6.0
README
Just another multi tenant support package for Laravel. Heavily inspired from Mohamed Said multitenancy videos.
Installation
You can install the package via composer:
composer require binarcode/laravel-tenantable
Now lets setup it:
php artisan tenantable:setup
Usage
Let's say you have the App\Models\Organization
as a tenant model.
This model has to implement the BinarCode\Tenantable\Tenant\Contracts\Tenant
contract.
If you want to benefit of all the methods the contract as you to implement, just extends the BinarCode\Tenantable\Models\Tenant
class, and you don't have to add anything else in your model.
Now I'll take it step by step, since I was very confused when I implemented my firt multitenancy application.
Migrations
You need 2 types of migrations, master
and tenant
. The migrations in the app\database\migrations
directory, are used for tenant
. If you have to add migrations for the master
use app\database\migrations\master
directory.
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email eduard.lupacescu@binarcode.com instead of using the issue tracker.
Credits
Credits
The code of this package is based on the code shown in the Multitenancy in Laravel series by Mohamed Said
Alternatives
- spatie/laravel-multitenancy
- tenancy/tenancy
- stancl/tenancy
- gecche/laravel-multidomain
- romegadigital/multitenancy
License
The MIT License (MIT). Please see License File for more information.