Files
filament/tests/database/migrations/0001_create_teams_table.php
Chris Jones 7e4b8a5b0e 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>
2026-03-30 10:12:39 +01:00

27 lines
705 B
PHP

<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
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();
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('teams');
}
};