mirror of
https://github.com/archtechx/tenancy.git
synced 2025-12-12 14:14:04 +00:00
Identification middleware & tests
This commit is contained in:
parent
a17727b437
commit
8ea4940f34
18 changed files with 362 additions and 174 deletions
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace Stancl\Tenancy\Resolvers;
|
||||
|
||||
use Stancl\Tenancy\Contracts\Domain;
|
||||
use Stancl\Tenancy\Contracts\Tenant;
|
||||
use Stancl\Tenancy\Contracts\TenantResolver;
|
||||
use Stancl\Tenancy\Exceptions\TenantCouldNotBeIdentifiedOnDomainException;
|
||||
|
|
@ -10,6 +11,7 @@ class DomainTenantResolver implements TenantResolver
|
|||
{
|
||||
public function resolve(...$args): Tenant
|
||||
{
|
||||
/** @var Domain $domain */
|
||||
$domain = config('tenancy.domain_model')::where('domain', $args[0])->first();
|
||||
|
||||
if ($domain) {
|
||||
|
|
@ -18,4 +20,4 @@ class DomainTenantResolver implements TenantResolver
|
|||
|
||||
throw new TenantCouldNotBeIdentifiedOnDomainException($domain);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue