Skip to content

Full v4 changelog

Version 4 brings many new features, with the most important ones being:

  • PostgreSQL RLS
  • Jetstream/Fortify support
  • Early identification and a general overhaul of routing logic
  • Resource syncing refactor
  • New tenancy bootstrappers

If you’re upgrading from v3, the main changes that will affect you are:

  • Namespace changes (mostly database-related things being moved to a dedicated namespace). These are easily resolved with any modern IDE
  • New config structure. You will have to delete and republish it (and then re-apply your changes, if any). It’s recommended to also do this with the TenancyServiceProvider
  • Several static properties being removed and replaced with config keys
  • Changes to routing logic (if you’re using universal routes)

Diff: d0de09a...master

  • Respect user-defined $onFail in the Universal Routes feature 233a122 #679
  • Change how tenants:run is used with arguments a45aa8e #912 #686
  • Stronger typing, minor changes to the Tenant interface 55d0a9a 8af354c 87212e5 d463e2d a94227a f98a901 942d79c
  • Improved namespacing, all database-related logic was moved to namespaces under Stancl\Tenancy\Database 40bf28c
  • Refactor TenantDatabaseManagers d2e1ce0 0fc1054
  • Fix/improve Ignition solutions 55d0a9a 3542b3f
  • Reverse order of tenancy bootstrappers when reverting to central context 62d19c5 #932
  • Make impersonation tokens require stateful guards 3bf2c39 #935
  • Remove configurable static property from BelongsToTenant trait (deprecated in PHP 8.1), replace it with a config key 24146b2 e5bc8dd
  • Refactor more static properties to config keys ccaba05
  • Improve CLI command outputs using Laravel 9+ components e4f5b92 #968 5d688e6 68de360 #1030
  • Change TenantDatabaseManager-related interfaces, add public database(): Connection method fe0a322
  • Make tenants:migrate default to configured schema path a1a976c #985
  • Use a dedicated DB connection for creating/deleting tenant databases bf504f4 #946 (fixes bug #515)
  • Improve resource syncing logic 77c5ae1 #915 (fixes bug #658) 22d1b20 #993 ea3e445 #992, 758fbc8 #997 (adds polymorphic table for mapping resources to tenants) 6784685 77226cf
  • Centralize config used by BelongsToTenant and HasDomains, replace all tenant_id literals dd0f03f 2a39b05 (fix #998), 82fa6cb
  • Convert publishable migrations to anonymous classes fb2369d #1001
  • Early identification (old version: ff46bcf, new version: 1d0ca27), related: 4953c69 e4df597 df9324b c312156 80b1183 4e51cdb, more cloning changes b789f5c 0f7cd2e #1362 #1353 #1371 b2f2669
  • Manual mode improvements (use correct event type, add new listeners) 73c5655 #1013
  • Add remember bool column to ImpersonationToken 228c267 #1101
  • Minor migrate:rollback fixes b503dbf
  • Fix PathTenantResolver when resolving tenant from cache 8db27a3, related aa1437f
  • Require MySQL 8 fd6070f
  • Disable asset_helper_tenancy by default, make the controller more configurable a39da04, related (rename + misc changes): 657e165
  • Simplify Tenant contract, move run() logic to Tenancy, add generics af3b693
  • Simplify TenantWithDatabase contract, move tenantConfig() logic e8c3c75 29d1469
  • Drop Laravel 10 support ce8e74e
  • Add $ignoreExisting static property to CreateDatabase bf1ba69
  • Filesystem logic refactor a41ad69
  • Cache prefixing logic rewrite, session scoping improvements eecf6f2, also ScopeSessions improvement dc90e60
  • Support non-interactive tenancy:install 8b41ea3
  • SQLite: use .sqlite suffix if no suffix is specified 836a258
  • SQLite: use WAL mode for newly created DBs by default (configurable) 9ee1d63 (todo: might get reverted since Laravel has config for this now)
  • Consume PendingDispatch return values in Tenancy::run() (see #1277) 3c183e4 b9cc63f ffad2db
  • Queue logic refactor (todo explain in depth) 8f958d5
  • runForMultiple() now doesn’t execute when passed an empty array 30ee4e9
  • URL generation, request data identification improvements (both added in v4, see previous points) #1357
  • Only revert initialized bootstrappers #1385
  • Use globalCache in CachedTenantResolver 3984d64
  • Fix ViteBundler not affecting Vite static calls #1389