Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Laravel Multitenancy Laravel Package

spatie/laravel-multitenancy

Unopinionated multitenancy for Laravel. Detect the current tenant per request and run configurable tasks when switching tenants. Supports single or multiple databases, tenant-aware queued jobs, per-tenant Artisan commands, and easy model connection handling.

View on GitHub
Deep Wiki
Context7
4.2.0

What's Changed

Processing a job no longer leaves the surrounding code with a different current tenant than it had before (#639, #643).

On the sync connection and through dispatchSync(), a job runs inside the request that dispatched it. A job that is not tenant aware forgot the current tenant and never put it back, so the rest of the request continued without one. A tenant aware job for another tenant left that other tenant current. Whatever tenant was current before a job starts is now restored when it finishes, on both the success and the failure path, and nested sync dispatches restore per level.

queue:retry behaves the same way. It needs the tenant of a failed job while it pushes that job back onto the queue, but the tenant of the code that ran the command is restored once it finishes. This matters when retrying jobs from a request with Artisan::call('queue:retry').

Behaviour worth knowing about when upgrading: on a queue worker the tenant of a processed job no longer stays current after that job finishes. Every job binds its own tenant, so jobs are unaffected, but code reading Tenant::current() in between jobs now sees no tenant. Listeners that are part of processing a job, Queue::after() and JobFailed for instance, still see the tenant of the job they are handling.

  • Update actions/checkout to v7 (#644)

Full Changelog: https://github.com/spatie/laravel-multitenancy/compare/4.1.5...4.2.0

4.1.5
4.1.4

What's Changed

New Contributors

Full Changelog: https://github.com/spatie/laravel-multitenancy/compare/4.1.3...4.1.4

4.1.3

What's Changed

Full Changelog: https://github.com/spatie/laravel-multitenancy/compare/4.1.2...4.1.3

4.1.1

What's Changed

New Contributors

Full Changelog: https://github.com/spatie/laravel-multitenancy/compare/4.1.0...4.1.1

4.0.9

What's Changed

Full Changelog: https://github.com/spatie/laravel-multitenancy/compare/4.0.8...4.0.9

4.0.8

What's Changed

New Contributors

Full Changelog: https://github.com/spatie/laravel-multitenancy/compare/4.0.7...4.0.8

4.0.7

What's Changed

New Contributors

Full Changelog: https://github.com/spatie/laravel-multitenancy/compare/4.0.6...4.0.7

4.0.6

What's Changed

New Contributors

Full Changelog: https://github.com/spatie/laravel-multitenancy/compare/4.0.5...4.0.6

4.0.5

What's Changed

New Contributors

Full Changelog: https://github.com/spatie/laravel-multitenancy/compare/4.0.4...4.0.5

4.0.3

What's Changed

New Contributors

Full Changelog: https://github.com/spatie/laravel-multitenancy/compare/4.0.2...4.0.3

4.0.2

What's Changed

New Contributors

Full Changelog: https://github.com/spatie/laravel-multitenancy/compare/4.0.1...4.0.2

4.0.1
  • Fix NotTenantAware notifications, mailables, closures, listeners & broadcast events in a default tenant aware application

Full Changelog: https://github.com/spatie/laravel-multitenancy/compare/4.0.0...4.0.1

4.0.0

What's Changed

New Contributors

Full Changelog: https://github.com/spatie/laravel-multitenancy/compare/3.2.0...4.0.0

2.3.9
  • Fix an issue where the Illuminate\Cache\Repository was not being cleared from the container

Full Changelog: https://github.com/spatie/laravel-multitenancy/compare/2.3.8...2.3.9

3.0.0

Breaking change

  • NotTenantAware jobs will now forget any current tenant that might have been set when starting processing.
2.3.8

What's Changed

New Contributors

Full Changelog: https://github.com/spatie/laravel-multitenancy/compare/2.3.7...2.3.8

2.3.7
2.3.6
2.3.5
2.3.4
2.3.2
  • add support for Laravel 9
2.3.1

Full Changelog: https://github.com/spatie/laravel-multitenancy/compare/2.3.0...2.3.1

2.2.0
  • Handle JobRetryRequested queue event and fix (#259)
  • 🐛 tenants:artisan backslashes (#296)
2.1.1
  • add filterCurrent and rejectCurrent to TenantCollection (#275)
2.1.0
  • add Laravel Octane support
2.0.0
  • drop support for PHP 7
1.6.11
  • allow PHP 8
1.6.10
  • NeedsTenant ability to return or redirect
1.6.9
  • fix for BroadcastEvent (#142)
1.6.8
  • add ability to dispatch events tenant aware
1.6.7
  • add support for Laravel 8
1.6.6
  • restored check isCurrent from makeCurrent
1.6.5
  • 🐛 removed check isCurrent from makeCurrent
1.6.4
  • forget current when making new tenant current
1.6.3
  • removed $guarded from Tenant model
1.6.2
  • TenantAware now uses the Tenant model from config
1.6.1
  • TenantsArtisanCommand now uses TenantAware trait
1.6.0
  • added TenantAware
1.5.1
  • 🐛 properly handle queued mailables and notification (#78)
1.5.0
  • database switch fails with misconfigured tenant (#92)
1.4.0
  • added execute for the landlord
1.3.0
  • added $tenant->execute($callable) to execute isolated tenant code (#60)
1.2.0
  • tenant:artisan search field customizable using config (#52)
1.1.5
  • allow mass assignment when creating a new tenant by default (#57)
1.1.4
  • improve error handling of tenant aware jobs
1.1.3
  • always register the tenants artisan command, so it may be called from web requests as well.
1.1.2
  • remove unused import from config (#20)
1.1.1
  • use the configured tenant model in artisan command (#17)
1.1.0
  • fix published migration name
  • ask for artisan command if none is given
1.0.0
  • initial release
What's
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
calmfox/watch-sylius
damienfern/grpc-symfony-bundle
atoolo/index-bundle
atoolo/genai-bundle
coprotoai/laravel-ticket
davidjln/llm-carbon-bundle
cryonighter/valid-request-bundle
coolms/taxonomy-bundle
coolms/field-bundle
articulate-orm/symfony
aaix/laravel-tall-architect
ephoto/akeneo-connector
emmanuelballery/eb-plantumlbundle
emielburgman/symfony-visitor-beacon
emielburgman/symfony-visit-storage
emielburgman/symfony-security-headers
emielburgman/symfony-log-viewer
emarref/xdebug-bundle
emarref/pubnub-bundle
elriseio/finance-money-bundle