Skip to content

Commit 0c6e76f

Browse files
committed
chore: Throw a compatibility exception when using the cookie identity resolver and service override
Refs: #75
1 parent 8b1aa22 commit 0c6e76f

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/Http/Resolvers/CookieIdentityResolver.php

+9
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,12 @@
1111
use Illuminate\Support\Facades\Cookie;
1212
use Sprout\Contracts\Tenancy;
1313
use Sprout\Contracts\Tenant;
14+
use Sprout\Exceptions\CompatibilityException;
1415
use Sprout\Http\Middleware\TenantRoutes;
16+
use Sprout\Overrides\CookieOverride;
1517
use Sprout\Support\BaseIdentityResolver;
1618
use Sprout\Support\PlaceholderHelper;
19+
use function Sprout\sprout;
1720

1821
/**
1922
* Cookie Identity Resolver
@@ -112,9 +115,15 @@ public function getRequestCookieName(Tenancy $tenancy): string
112115
* @param \Sprout\Contracts\Tenancy<TenantClass> $tenancy
113116
*
114117
* @return string|null
118+
*
119+
* @throws \Sprout\Exceptions\CompatibilityException
115120
*/
116121
public function resolveFromRequest(Request $request, Tenancy $tenancy): ?string
117122
{
123+
if (sprout()->hasOverride(CookieOverride::class)) {
124+
throw CompatibilityException::make('resolver', $this->getName(), 'override', CookieOverride::class);
125+
}
126+
118127
/**
119128
* This is unfortunately here because of the ludicrous return type
120129
*

0 commit comments

Comments
 (0)