1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2026-02-06 13:34:05 +00:00
tenancy/src/Resolvers
Ralfs c21beabd3e
Fix issue 632: cached lookup (#633)
* 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>
2021-04-16 19:57:41 +02:00
..
Contracts Fix issue 632: cached lookup (#633) 2021-04-16 19:57:41 +02:00
DomainTenantResolver.php Fix issue 632: cached lookup (#633) 2021-04-16 19:57:41 +02:00
PathTenantResolver.php Rewrite cached resolver logic to allow for cache invalidation logic 2020-06-02 20:10:17 +02:00
RequestDataTenantResolver.php Rewrite cached resolver logic to allow for cache invalidation logic 2020-06-02 20:10:17 +02:00