mirror of
https://github.com/archtechx/tenancy.git
synced 2026-02-05 11:44:04 +00:00
refactor RootUrlBootstrapper
This commit is contained in:
parent
9f09c9e6dd
commit
4e126846f9
1 changed files with 17 additions and 10 deletions
|
|
@ -44,10 +44,18 @@ class RootUrlBootstrapper implements TenancyBootstrapper
|
||||||
|
|
||||||
public function bootstrap(Tenant $tenant): void
|
public function bootstrap(Tenant $tenant): void
|
||||||
{
|
{
|
||||||
$shouldRunInTests = ! app()->runningUnitTests() || static::$rootUrlOverrideInTests;
|
if (static::$rootUrlOverride === null) {
|
||||||
$shouldRun = $this->app->runningInConsole() && $shouldRunInTests && static::$rootUrlOverride;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! $this->app->runningInConsole()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (app()->runningUnitTests() && ! static::$rootUrlOverrideInTests) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if ($shouldRun) {
|
|
||||||
$this->originalRootUrl = $this->app['url']->to('/');
|
$this->originalRootUrl = $this->app['url']->to('/');
|
||||||
|
|
||||||
$newRootUrl = (static::$rootUrlOverride)($tenant, $this->originalRootUrl);
|
$newRootUrl = (static::$rootUrlOverride)($tenant, $this->originalRootUrl);
|
||||||
|
|
@ -55,7 +63,6 @@ class RootUrlBootstrapper implements TenancyBootstrapper
|
||||||
$this->app['url']->forceRootUrl($newRootUrl);
|
$this->app['url']->forceRootUrl($newRootUrl);
|
||||||
$this->config->set('app.url', $newRootUrl);
|
$this->config->set('app.url', $newRootUrl);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public function revert(): void
|
public function revert(): void
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue