D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home
/
dateitor
/
public_html
/
app
/
Resolvers
/
Filename :
MultiTenantResolver.php
back
Copy
<?php declare(strict_types=1); namespace App\Resolvers; use Stancl\Tenancy\Contracts\Tenant; use Stancl\Tenancy\Exceptions\TenantCouldNotBeIdentifiedByPathException; class MultiTenantResolver { public function resolve(...$args): Tenant { if ($tenant = tenancy()->find(getLogInTenantId())) { return $tenant; } throw new TenantCouldNotBeIdentifiedByPathException(getLogInTenantId()); } public function getArgsForTenant(Tenant $tenant): array { return [ [$tenant->id], ]; } }