mirror of
https://github.com/archtechx/tenancy.git
synced 2025-12-12 19:34:04 +00:00
Automatic multi-tenancy for Laravel. No code changes needed.
https://tenancyforlaravel.com
* Instead of querying Domain model, find Tenant and eager load it's domain via Tenant model. Fixed cached lookup issue - when caching Tenant, also include the current Domain, so it can be later accessed via $tenant->domains->first() (even, when using multiple domains per tenant). Added tenantIdentifiedFromCache method in CachedTenantResolver.php, which can be used to set custom properties in resolvers after Tenant is loaded from cache. * StlyeCi Fix - removed PHP 8 nullsafe operator for compatibility with older PHP versions, replaced with inline if * Redundant variable '$domain', because $tenant is not null, only, when current domain is found and relationship is loaded (with only one domain). * Fixed tenant()->domains showing incorrect data. Renamed tenantIdentifiedFromCache() method and removed duplicate code, when setting current domain. * Removed select() for better flexibility, added new method setCurrentDomain(), refactored the usage of tenantIdentified(). * rename method to resolved() * clean up code * StyleCi Fix Co-authored-by: Samuel Štancl <samuel.stancl@gmail.com> |
||
|---|---|---|
| .github | ||
| art | ||
| assets | ||
| src | ||
| tests | ||
| .gitattributes | ||
| .gitignore | ||
| .styleci.yml | ||
| composer.json | ||
| CONTRIBUTING.md | ||
| docker-compose.yml | ||
| Dockerfile | ||
| DONATIONS.md | ||
| LICENSE | ||
| phpunit.xml | ||
| README.md | ||
| SUPPORT.md | ||
| test | ||
Tenancy for Laravel — stancl/tenancy
Automatic multi-tenancy for your Laravel app.
You won't have to change a thing in your application's code.
- ✔️ No model traits to change database connection
- ✔️ No replacing of Laravel classes (
Cache,Storage, ...) with tenancy-aware classes - ✔️ Built-in tenant identification based on hostname (including second level domains)
Documentation
Documentation can be found here: https://tenancyforlaravel.com/docs/v3/
The repository with the documentation source code can be found here: stancl/tenancy-docs.
Need help?
Credits
- Package created by Samuel Štancl
- Design help & current logo by Florian Karsten
