1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2025-12-12 16:24:04 +00:00

get down to 59 phpstan errors

This commit is contained in:
Samuel Štancl 2022-09-29 22:20:55 +02:00
parent 193e044777
commit a94227a19c
26 changed files with 130 additions and 130 deletions

View file

@ -9,6 +9,7 @@ use Illuminate\Http\Request;
use Illuminate\Routing\Route;
use Illuminate\Support\Facades\Event;
use Illuminate\Support\Facades\URL;
use Stancl\Tenancy\Contracts\Tenant;
use Stancl\Tenancy\Events\InitializingTenancy;
use Stancl\Tenancy\Exceptions\RouteIsMissingTenantParameterException;
use Stancl\Tenancy\Resolvers\PathTenantResolver;
@ -36,7 +37,10 @@ class InitializeTenancyByPath extends IdentificationMiddleware
if ($route->parameterNames()[0] === PathTenantResolver::$tenantParameterName) {
// Set tenant as a default parameter for the URLs in the current request
Event::listen(InitializingTenancy::class, function (InitializingTenancy $event) {
URL::defaults([PathTenantResolver::$tenantParameterName => $event->tenancy->tenant->getTenantKey()]);
/** @var Tenant $tenant */
$tenant = $event->tenancy->tenant;
URL::defaults([PathTenantResolver::$tenantParameterName => $tenant->getTenantKey()]);
});
return $this->initializeTenancy(