Fix dashboard route overwritten by home redirect when using tenant slug attribute#19584
Merged
danharrin merged 2 commits intofilamentphp:4.xfrom Mar 30, 2026
Merged
Conversation
danharrin
approved these changes
Mar 30, 2026
…ug attribute
`Route::getLastGroupPrefix()` returns the raw group prefix including
binding syntax (e.g. `admin/{tenant:slug}`), but Laravel's
`RouteCollection` indexes routes by the normalized URI without binding
syntax (e.g. `admin/{tenant}`). The `isset()` check on line 182 fails
due to this key mismatch when a tenant slug attribute is configured,
causing the home redirect to be created at `/` and overwrite the
Dashboard route.
The fix strips binding syntax from the root URI before looking it up
in the route collection.
Fixes filamentphp#19582
381c8a3 to
7ed97b2
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #19582
Problem
When a panel uses
->tenant(Model::class, 'slug')with a tenant slug attribute, the Dashboard page route (filament.{panel}.pages.dashboard) is never registered. Instead, it's overwritten by thehomeredirect (RedirectToHomeController).Root cause:
Route::getLastGroupPrefix()returns the raw group prefix including binding syntax (admin/{tenant:slug}), but Laravel'sRouteCollectionindexes routes by the normalized URI without binding syntax (admin/{tenant}). Theisset()check fails due to this key mismatch, so the guard thinks no root route exists and registers the home redirect — which overwrites the Dashboard.Fix
Strip binding syntax from
$rootUribefore looking it up in the route collection:Tests
Added two tests that verify:
Both tests fail without the fix and pass with it. All existing route tests continue to pass.