Releases: archtechx/tenancy
v2.2.1
v2.2.0
Added
- Conflicting routes - you may now use the same URLs in the tenant & central parts of the app docs
- Universal routes - you may now use the same routes (e.g.
Auth::routes()
or Nova routes) for both the tenant & central part of the app docs - Much richer event system (docs), allowing for things like:
- jobs to be put into the queue chain of the job that creates tenant DBs, without race conditions
- seeding tenant data on creation
created_at
/updated_at
/deleted_at
timestamps
- Optional Timestamps feature docs
TenantAwareCommand
trait for commands docs- Find tenant by any key docs
- Deleting keys from tenant storage docs
- Better IDE support for global helpers (
tenancy()
&tenant()
)
Fixes
tenants:migrate
now accepts--path
v2.1.2
v2.1.1
v2.1.0
2.1.0
Added:
- Automatic seeding after tenant creation can now be enabled
$tenant->run()
-- run a closure inside a tenant's environment Documentation- Nova integration Documentation
- spatie/laravel-activitylog integration Documentation
- Central queue connections Documentation
- The MySQLDatabaseManager now respects your charset & collation instead of always using
utf8mb
&utf8mb4_unicode_ci
Bug fixes:
- Fixed: Tenant routes are now registered even in HTTP tests.
- Fixed: The queued DB creators, deletors and migrators were causing serialization issues under some conditions.
Bug fixes with breaking changes:
Queue race conditions
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
middleware
The 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.
v2.0.1
v2.0.0
🎉 2.0.0
Main changes
Tenant
objects are now used, instead of arrays, to represent tenants. See the Tenants page.- Tenants can now have multiple domains, so a new
domains
table is used by the DB storage driver. - The
uuid
property on tenants is nowid
. tenancy()
helper now returns an instance ofTenantManager
while thetenant()
helper returns an instance of the currentTenant
. If noTenant
has been identified,null
is returned. Same with theTenancy
andTenant
facades.- Event listeners/hooks have a new syntax:
Tenancy::eventListener('bootstrapping', function () {})
- The tenancy bootstrapping logic has been extracted into separate classes, such as
DatabaseTenancyBootstrapper
,CacheTenancyBootstrapper
etc. - A concept of
Feature
s was introduced. They're classes that provide additional functionality - functionality that is not necessary to bootstrap tenancy. - predis support was dropped. Laravel will drop predis support in 7.x.
- There is new syntax for creating and interacting with tenants, be sure to read those documentation pages again.
- The config was changed a lot, so you should publish and configure it again.
You can publish the configuration like this:php artisan vendor:publish --provider='Stancl\Tenancy\TenancyServiceProvider' --tag=config
DB storage driver
- The
uuid
column in thetenants
table was renamed toid
. Thedomain
column was dropped. - A new migration was added to create the
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.
You can publish migrations like this:php artisan vendor:publish --provider='Stancl\Tenancy\TenancyServiceProvider' --tag=migrations
Redis storage driver
- The
uuid
keys are nowid
. - The
domain
key was dropped. - The
_tenancy_domains
key is used to store an array of domains that belong to the tenant.
New Features
v2.0.0-rc2
Bug fixes, config was restructured, tenants:migrate-fresh
was added, TenantConfig
feature was added, UUID generator was moved to a different namespace.
v2.0.0-rc1
Changelog will be published when v2.0.0 is released.
The documentation is updated for v2.0.0-rc1.
v1.8.0
Added
- Multi-tenant Jobs: Jobs are now automatically multi-tenant. The documentation page covers the small tweaks you will have to make to your config to get multi-tenant jobs to work.
- Telescope Integration: You can read more about this on the documentation page.
- Horizon Integration: You can read more about this on the documentation page.
- Tenant Redirect and Custom ID schemes: You can now easily redirect to tenant domains. You can also use a custom tenant ID scheme if you don't like UUIDs. You can read about these features here.
Fixed
- #112 PostgreSQL Database creation error.
Code
- Strict types declaration is now used in every file.