Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

myregistration's avatar

Please tell me how to use route parameters with a Filament panel and it's routes

How can I use route parameters with Filament panels? This seems fundamental for Laravel applications and I can't seem to get it to work with Filament. I would like to use the following format.

Route::prefix('organization/{organization:slug}')->group(function () {
	// Filament routes
});

I tried to set the Panel path to ->path('/organization/{organization:slug}') instead of adding routes to the web.php file, but that doesn't work. I tried overriding the Filament routes listed in php artisan route:list, but that didn't work well either; seems like it gets confused which panel to use ( I have multiple). Plus that method seems kludgy and high maintenance.

Advice is appreciated. Thanks

0 likes
8 replies
Jsanwo64's avatar

@myregistration I responded thinking it was a method as specified in the comment in your actual code

Route::prefix('organization/{organization:slug}')->group(function () {
	// Filament routes
});

Try to integrate Filament panels with route parameters, you'll typically use the standard Laravel routing methods along with Filament's routes.

use Filament\Panel;

Route::prefix('organization/{organization:slug}')->group(function () {
    Panel::register(MyPanel::class) //your Panel Class goes here
        ->path('/dashboard') // Set the path for your panel
        ->name('admin.dashboard'); // Set the panel name
});

or try understanding with these steps

a. Define Your Route with Parameters:

Route::get('/panel/{id}', [PanelController::class, 'show'])->name('panel.show');

b. Create a Filament Panel:

Create a Filament panel using the artisan command or by manually creating the panel class. Make sure the panel class extends Filament\Panel and implements Filament\Panel\Contracts\CanInteractWithModel.

c. Implement Route Parameter Usage in the Panel:

use Illuminate\Http\Request;

public function view(Request $request)
{
    $id = $request->route('id');
    // Use $id to fetch data or perform any logic based on the route parameter
    return view('filament.panels.panel-name', ['id' => $id]);
}

d. Link to the Panel Route with Parameters:

<a href="{{ route('panel.show', ['id' => $someId]) }}">Show Panel</a>
myregistration's avatar

@jsanwo64 Is there a Route method named filament()? I can't find that in the documentation. I get the following errors:

attribute filament doesn't exist and also error with 

Method Illuminate\Routing\RouteRegistrar::model does not exist.

Method App\Filament\Organization\Pages\Dashboard::route does not exist.

Where did you find the code for this process? Can you send me a link? Thanks

Please or to participate in this conversation.