trailblazersoftware/multi-tenant
Laravel Multi-Tenant Roles
This Laravel 5.5+ package provides an implementation of roles and permissions in a multi-tenant application. It borrows a lot from Entrust. Although all the Entrust functionalities are not yet implemented here, the roadmap includes doing so. The intend is for Laravel Multi-Tenant Roles to provide the following improvement (over Entrust):
-
Multi-Tenancy "out of the box".
-
Localization. Being able to provide a display name and descriptions for a role or permission in whatever language your Laravel application supports.
Installation
To install, simply run the command below in your terminal.
composer require "trailblazersoftware/multi-tenant:dev-master"
Setup
Multi Tenant uses Laravel's Auto-Discovery feature to register its Service Provider, and allow you to run its migration and publish its config file.
Publish The Config File
Run the following artisan command:
php artisan vendor:publish --provider="Trailblazer\MultiTenant\MultiTenantServiceProvider"
Or, you can type even less by simply typing php artisan vendor:publish and selecting the number corresponding to Trailblazer\MultiTenant\MultiTenantServiceProvider
Update The Config File
After running the vendor:publish command, you'll see a new config file MultiTenant.php in your projects_root/config directory.
| Config Key | Default | Description | Required |
|---|---|---|---|
| 'role' | 'App\Models\Users\Role' | The Role model | Yes |
| 'roles_table' | 'roles' | The table where role models are stored | Yes |
| 'users_table' | 'users' | The table where user models are stored | Yes |
| 'user_key' | 'id' | The primary key for the user model | Yes |
| 'role_user_table' | 'role_user' | The pivot table where users' roles are stored | Yes |
| 'role_user_table' | 'role_user' | The pivot table where users' roles are stored | Yes |
| 'permission' | 'role_user' | The pivot table where users' roles are stored | Yes |
Related Packages
Powerful PHP database abstraction layer (DBAL) with many features for database s...
Laravel Serializable Closure provides an easy and secure way to serialize closur...
Cli error handling for console/command-line PHP applications.