diff --git a/src/Features/CrossDomainRedirect.php b/src/Features/CrossDomainRedirect.php index 8cdb19c0..8eecaeee 100644 --- a/src/Features/CrossDomainRedirect.php +++ b/src/Features/CrossDomainRedirect.php @@ -12,7 +12,7 @@ class CrossDomainRedirect implements Feature { public function bootstrap(TenantManager $tenantManager): void { - RedirectResponse::macro('tenant', function (string $domain) { + RedirectResponse::macro('domain', function (string $domain) { // replace first occurance of hostname fragment with $domain $url = $this->getTargetUrl(); $hostname = parse_url($url, PHP_URL_HOST); diff --git a/tests/RedirectTest.php b/tests/RedirectTest.php index c0bd90a8..ededb239 100644 --- a/tests/RedirectTest.php +++ b/tests/RedirectTest.php @@ -5,6 +5,7 @@ declare(strict_types=1); namespace Stancl\Tenancy\Tests; use Route; +use Stancl\Tenancy\Features\CrossDomainRedirect; use Stancl\Tenancy\Tenant; class RedirectTest extends TestCase @@ -16,7 +17,7 @@ class RedirectTest extends TestCase public function tenant_redirect_macro_replaces_only_the_hostname() { config([ - 'tenancy.features' => ['Stancl\Tenancy\Features\TenantRedirect'], + 'tenancy.features' => [CrossDomainRedirect::class], ]); Route::get('/foobar', function () { @@ -24,7 +25,7 @@ class RedirectTest extends TestCase })->name('home'); Route::get('/redirect', function () { - return redirect()->route('home')->tenant('abcd'); + return redirect()->route('home')->domain('abcd'); }); Tenant::create('foo.localhost');