F
Filament6mo ago
andyov

Allow Relation Manager to to link to the `view` page rather than open a modal

The docs state if a view page exists, a ViewAction will use that instead of open a modal. This works on a basic resource table, but it is still opening as a modal on a RelationManager's table() method. Does anyone know if there anyway to force it top open as a url rather than modal?
4 Replies
nanopanda
nanopanda6mo ago
@andyov You can modify the EditAction url to do something like this, where "yourpanelname" is your Filament panel's route name, and "relation_resource_name" is your child Resource's route name. Artisan route:list will give you the exact route path if you need to check it. Tables\Actions\EditAction::make()->url(fn ($record): string => route( 'filament.yourpanelname.resources.relation_resource_name.edit', ['record' => $record ] ) )
krekas
krekas6mo ago
but don't use route to make a url
andyov
andyovOP6mo ago
Thanks both, very helpful. Went with the following:
Tables\Actions\ViewAction::make()->url(fn ($record): string => TheResource::getUrl('view', ['record' => $record])),
Tables\Actions\ViewAction::make()->url(fn ($record): string => TheResource::getUrl('view', ['record' => $record])),
Want results from more Discord servers?
Add your server