mirror of
https://github.com/archtechx/tenancy.git
synced 2025-12-14 01:24:05 +00:00
Fix origin id w/ empty header & using full-hostname subdomain records
This makes it possible to have Domain records in both `foo` and
`foo.{centralDomain}` format when using the combined domain/subdomain
identification middleware, or the origin header id mw which extends it.
This commit also refactors some related logic.
This commit is contained in:
parent
c199a6e0c8
commit
56dd4117ab
7 changed files with 131 additions and 63 deletions
|
|
@ -44,7 +44,12 @@ class InitializeTenancyByDomain extends IdentificationMiddleware
|
|||
*/
|
||||
public function requestHasTenant(Request $request): bool
|
||||
{
|
||||
return ! in_array($this->getDomain($request), config('tenancy.identification.central_domains'));
|
||||
$domain = $this->getDomain($request);
|
||||
|
||||
// Mainly used with origin identification if the header isn't specified and e.g. universal routes are used
|
||||
if (! $domain) return false;
|
||||
|
||||
return ! in_array($domain, config('tenancy.identification.central_domains'));
|
||||
}
|
||||
|
||||
public function getDomain(Request $request): string
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue