Skip to content

BinarCode/laravel-tenantable

Repository files navigation

Laravel Tenantable

Total Downloads Latest Stable Version License

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.

... See oficial documenation

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 [email protected] 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

License

The MIT License (MIT). Please see License File for more information.