Automatic multi-tenancy for Laravel. No code changes needed.
MIT License
Bot releases are hidden (Show)
Published by stancl almost 5 years ago
Auth::routes()
or Nova routes) for both the tenant & central part of the app docs
created_at
/updated_at
/deleted_at
timestampsTenantAwareCommand
trait for commands docs
tenancy()
& tenant()
)tenants:migrate
now accepts --path
Published by stancl about 5 years ago
Published by stancl about 5 years ago
Published by stancl about 5 years ago
$tenant->run()
-- run a closure inside a tenant's environment Documentation
utf8mb
& utf8mb4_unicode_ci
When both DB creation & migration were queued (after tenant creation), a race condition could happen, i.e. the migrate job would be executed before the create DB job.
Breaking change: The queue_automatic_migration
configuration key was dropped. Whether post-creation migrations & seeding should be queued now depends on whether the DB creation is queued.
InitializeTenancy
middlewareThe InitializeTenancy
middleware was part of the route middleware stack, which means it was executed after controller constructors. This could result in problems when a dependency (constructor argument) was injected before tenancy was initialized.
The InitializeTenancy
middleware is now executed as part of the global middleware stack. That stack doesn't know whether the current route is a tenant route or a central route, it only knows if the current domain is a tenant domain. If tenancy was initialized on a non-tenant route (= if a central route was visited on a tenant domain), the PreventAccessFromTenantDomains
middleware aborts the request.
Breaking change: If you applied the InitializeTenancy
middleware on some routes manually, change it to 'tenancy'
-- a middleware group. The PreventAccessFromTenantDomains
middleware uses the presence of that middleware group as a check for whether a route is marked as tenant or not.
Published by stancl about 5 years ago
Config\Repository
contract instead of concrete #157tenancy.tenant_route_namespace
config in the route SP #161Published by stancl about 5 years ago
Tenant
objects are now used, instead of arrays, to represent tenants. See the Tenants page.domains
table is used by the DB storage driver.uuid
property on tenants is now id
.tenancy()
helper now returns an instance of TenantManager
while the tenant()
helper returns an instance of the current Tenant
. If no Tenant
has been identified, null
is returned. Same with the Tenancy
and Tenant
facades.Tenancy::eventListener('bootstrapping', function () {})
DatabaseTenancyBootstrapper
, CacheTenancyBootstrapper
etc.Feature
s was introduced. They're classes that provide additional functionality - functionality that is not necessary to bootstrap tenancy.php artisan vendor:publish --provider='Stancl\Tenancy\TenancyServiceProvider' --tag=config
uuid
column in the tenants
table was renamed to id
. The domain
column was dropped.domains
table. The old migration was renamed, so if you publish migrations again, be sure to delete the old migration, to avoid creating the table twice.php artisan vendor:publish --provider='Stancl\Tenancy\TenancyServiceProvider' --tag=migrations
uuid
keys are now id
.domain
key was dropped._tenancy_domains
key is used to store an array of domains that belong to the tenant.Published by stancl about 5 years ago
Bug fixes, config was restructured, tenants:migrate-fresh
was added, TenantConfig
feature was added, UUID generator was moved to a different namespace.
Published by stancl about 5 years ago
Changelog will be published when v2.0.0 is released.
The documentation is updated for v2.0.0-rc1.
Published by stancl about 5 years ago
Published by stancl about 5 years ago
tenancy:install
will do everything except DB/Redis connection creation for you. It will make changes to Http/Kernel.php, create routes/tenant.php
, publish config, and (optionally) publish the migration. more info
tenants:run
more info