How can I add a locale as a url parameter on a panel?

I tried adding a locale parameter to my code so that instead of this:

public function panel(Panel $panel): Panel
{
    return $panel
        ->id('books')
        //
        ->path('books/');
}


I have this:

public function panel(Panel $panel): Panel
{
    return $panel
        ->id('books')
        //
        ->path('books/{locale}');
}


But that did not work.
Solution
create a Middleware and register it in filament panel

URL::defaults(['local' => 'en']);

change en to the lang, if you want to get it from session or user profile or any logic you want

I used it like this
->path('{local}/admin')
Was this page helpful?