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

Make TenancyUrlGenerator inherit the original UrlGenerator's scheme

This commit is contained in:
lukinovec 2025-08-07 13:07:17 +02:00
parent f6a54defe6
commit 0bf7c10f0e

View file

@ -11,6 +11,7 @@ use Stancl\Tenancy\Contracts\TenancyBootstrapper;
use Stancl\Tenancy\Contracts\Tenant; use Stancl\Tenancy\Contracts\Tenant;
use Stancl\Tenancy\Overrides\TenancyUrlGenerator; use Stancl\Tenancy\Overrides\TenancyUrlGenerator;
use Stancl\Tenancy\Resolvers\PathTenantResolver; use Stancl\Tenancy\Resolvers\PathTenantResolver;
use Illuminate\Support\Str;
/** /**
* Makes the app use TenancyUrlGenerator (instead of Illuminate\Routing\UrlGenerator) which: * Makes the app use TenancyUrlGenerator (instead of Illuminate\Routing\UrlGenerator) which:
@ -78,6 +79,10 @@ class UrlGeneratorBootstrapper implements TenancyBootstrapper
} }
} }
// Inherit scheme (http/https) from the original generator
$originalScheme = Str::before($this->originalUrlGenerator->formatScheme(), '://');
$newGenerator->forceScheme($originalScheme);
$newGenerator->defaults($defaultParameters); $newGenerator->defaults($defaultParameters);
$newGenerator->setSessionResolver(function () { $newGenerator->setSessionResolver(function () {