1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2025-12-13 19:04:03 +00:00

Fix event listener tests, improve domain logic

This commit is contained in:
Samuel Štancl 2020-05-09 02:49:08 +02:00
parent 0bbc66f451
commit a602cec940
13 changed files with 148 additions and 14 deletions

View file

@ -53,12 +53,10 @@ if (! function_exists('global_cache')) {
}
if (! function_exists('tenant_route')) {
function tenant_route($route, $parameters = [], string $domain = null)
function tenant_route(string $domain, $route, $parameters = [], $absolute = true)
{
$domain = $domain ?? request()->getHost();
// replace first occurance of hostname fragment with $domain
$url = route($route, $parameters);
$url = route($route, $parameters, $absolute);
$hostname = parse_url($url, PHP_URL_HOST);
$position = strpos($url, $hostname);