FilamentF
Filament12mo ago
harumi

dynamic index route

how to make the index route that accessed like dashboard/action/{record}
on the TransactionResource class i set the pages like this
    public static function getPages(): array
    {
        return [
            'index' => Pages\ListTransactions::route('/{record}'),
        ];
    }

it getting error like this when i access /dashboard/action/test
Missing required parameter for [Route: filament.admin.resources.action.index] [URI: dashboard/action/{record}] [Missing parameter: record].

it work when i set 2 route like
'index' => Pages\ListTransactions::route('/'),
'index2' => Pages\ListTransactions::route('/{record}'),

but i dont want to add the / route
how to fix that?
Solution
i think something like this is work for me
    public function getBreadcrumbs(): array
    {
        return [
            url()->current() => static::$breadcrumb ?? static::getTitle(),
            0 => request()->route('resource'),
        ];
    }

i override the getBreadcrumbs method from the ListTransactions class
this is correct?
Was this page helpful?