Skip to content

Commit

Permalink
Correct useTenantRoutesInFortify(), delete unused import
Browse files Browse the repository at this point in the history
  • Loading branch information
lukinovec committed Feb 20, 2025
1 parent fd902ea commit dd0a742
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/Bootstrappers/Integrations/FortifyRouteBootstrapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
use Illuminate\Config\Repository;
use Stancl\Tenancy\Contracts\TenancyBootstrapper;
use Stancl\Tenancy\Contracts\Tenant;
use Stancl\Tenancy\Enums\Context;
use Stancl\Tenancy\Resolvers\PathTenantResolver;

/**
Expand Down Expand Up @@ -78,14 +77,14 @@ protected function useTenantRoutesInFortify(Tenant $tenant): void
$tenantParameterName = static::$defaultParameterNames ? 'tenant' : PathTenantResolver::tenantParameterName();
$tenantParameterValue = static::$defaultParameterNames ? $tenant->getTenantKey() : PathTenantResolver::tenantParameterValue($tenant);

$generateLink = function (array $redirect) use ($tenantParameterValue, $tenantParameterName) {
return route($redirect['route_name'], static::$passTenantParameter ? [$tenantParameterName => $tenantParameterValue] : []);
$generateLink = function (string $redirect) use ($tenantParameterValue, $tenantParameterName) {
return route($redirect, static::$passTenantParameter ? [$tenantParameterName => $tenantParameterValue] : []);
};

// Get redirect URLs for the configured redirect routes
$redirects = array_merge(
$this->originalFortifyConfig['redirects'] ?? [], // Fortify config redirects
array_map(fn (array $redirect) => $generateLink($redirect), static::$fortifyRedirectMap), // Mapped redirects
array_map(fn (string $redirect) => $generateLink($redirect), static::$fortifyRedirectMap), // Mapped redirects
);

if (static::$fortifyHome) {
Expand Down

0 comments on commit dd0a742

Please sign in to comment.