packagist stancl/tenancy v2.1.0

latest releases: 3.x-dev, dev-fix-1229, v3.8.4...
4 years ago

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.

Don't miss a new tenancy release

NewReleases is sending notifications on new releases.