diff --git a/src/TenancyServiceProvider.php b/src/TenancyServiceProvider.php index c89ab19f..790e7210 100644 --- a/src/TenancyServiceProvider.php +++ b/src/TenancyServiceProvider.php @@ -5,9 +5,9 @@ namespace Stancl\Tenancy; use Stancl\Tenancy\Commands\Run; use Stancl\Tenancy\Commands\Seed; use Illuminate\Cache\CacheManager; -use Illuminate\Http\RedirectResponse; use Stancl\Tenancy\Commands\Install; use Stancl\Tenancy\Commands\Migrate; +use Illuminate\Http\RedirectResponse; use Illuminate\Support\Facades\Route; use Stancl\Tenancy\Commands\Rollback; use Illuminate\Support\ServiceProvider; @@ -57,9 +57,9 @@ class TenancyServiceProvider extends ServiceProvider RedirectResponse::macro('tenant', function (string $domain) { // replace first occurance of hostname fragment with $domain $url = $this->getTargetUrl(); - $hostname = parse_url($url, PHP_URL_HOST); - $position = strpos($url, $hostname); - $this->setTargetUrl(substr_replace($url, $domain, $position, strlen($hostname))); + $hostname = \parse_url($url, PHP_URL_HOST); + $position = \strpos($url, $hostname); + $this->setTargetUrl(\substr_replace($url, $domain, $position, \strlen($hostname))); return $this; }); diff --git a/tests/TenantRedirectMacroTest.php b/tests/TenantRedirectMacroTest.php index a90be15e..de44a650 100644 --- a/tests/TenantRedirectMacroTest.php +++ b/tests/TenantRedirectMacroTest.php @@ -20,4 +20,4 @@ class TenantRedirectMacroTest extends TestCase $this->get('/redirect') ->assertRedirect('http://abcd/foobar'); } -} \ No newline at end of file +}