1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2026-02-05 05:14:03 +00:00

Fix tenant_route without absolute

This commit is contained in:
Hecktor viegas 2024-05-24 11:03:17 -03:00 committed by GitHub
parent 8f9c7efa45
commit 399e6f0baf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 2 additions and 1 deletions

View file

@ -61,7 +61,7 @@ if (! function_exists('tenant_route')) {
{
// replace first occurance of hostname fragment with $domain
$url = route($route, $parameters, $absolute);
$hostname = parse_url($url, PHP_URL_HOST);
$hostname = parse_url($url, PHP_URL_HOST) ?? '';
$position = strpos($url, $hostname);
return substr_replace($url, $domain, $position, strlen($hostname));

View file

@ -42,5 +42,6 @@ class RedirectTest extends TestCase
$this->assertSame('http://foo.localhost/abcdef/as/df', tenant_route('foo.localhost', 'foo', ['a' => 'as', 'b' => 'df']));
$this->assertSame('http://foo.localhost/abcdef', tenant_route('foo.localhost', 'foo', []));
$this->assertSame('foo.localhost/abcdef', tenant_route('foo.localhost', 'foo', [], false));
}
}