Fix dashboard route overwritten by home redirect when using tenant slug attribute (#19584)

* Fix dashboard route overwritten by home redirect when using tenant slug 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/filament#19582

* update snapshots

---------

Co-authored-by: Dan Harrin <git@danharrin.com>
This commit is contained in:
Chris Jones
2026-03-30 10:12:39 +01:00
committed by GitHub
co-authored by Dan Harrin
parent 1d78f0123e
commit 7e4b8a5b0e
10 changed files with 84 additions and 1 deletions
+1
View File
@@ -13,6 +13,7 @@ class TeamFactory extends Factory
{
return [
'name' => $this->faker->company(),
'slug' => $this->faker->unique()->slug(),
'description' => $this->faker->sentence(),
];
}
@@ -11,6 +11,7 @@ return new class extends Migration
Schema::create('teams', function (Blueprint $table): void {
$table->id();
$table->string('name');
$table->string('slug')->unique()->nullable();
$table->text('description')->nullable();
$table->decimal('budget', 10, 2)->default(0);
$table->foreignId('company_id')->nullable();