RelationsManager Table View/Edit actions

I have this model called Group that has a recursive parent/child relationship based on a parent_id.
Inside the GroupRelationsManager I'm getting the associated GroupResource which shows all its children, however I'm trying to figure out how to change the links for the view and edit actions on the relations table. When I show the children of the relationship I'd like to be able to click Edit and go straight into the main editing of that specific Group rather than having it pop up in a modal, so that I can do a quick dive to either add more children/grandchildren or traverse the tree. How can I modify whether the link will popup in a modal or if it is the default edit/view link that is in the main table for that resource, specially since I'm just inheriting the table resource from the parent:
public function table(Table $table): Table
{
return GroupResource::table($table)
->headerActions([
Tables\Actions\CreateAction::make()
]);
}
public function table(Table $table): Table
{
return GroupResource::table($table)
->headerActions([
Tables\Actions\CreateAction::make()
]);
}
Solution:
Just tested it on one of my apps, and looks like the only change is that the second arg to getUrl() needs to be wrapped as an array: ```php Tables\Actions\EditAction::make() ->url(fn (Model $record) => PersonnelAssignmentResource::getUrl('edit', [$record])),...
Jump to solution
2 Replies
cheesegrits
cheesegrits11mo ago
I think this "trick" still works in v3, by just overriding the EditAction with a url() that gets your resource URL. https://v2.filamentphp.com/tricks/relation-manager-edit-record-without-modal
Filament
Relation Manager edit record using Resource page instead of modal b...
Filament is a collection of tools for rapidly building beautiful TALL stack apps, designed for humans.
Solution
cheesegrits
cheesegrits11mo ago
Just tested it on one of my apps, and looks like the only change is that the second arg to getUrl() needs to be wrapped as an array:
Tables\Actions\EditAction::make()
->url(fn (Model $record) => PersonnelAssignmentResource::getUrl('edit', [$record])),
Tables\Actions\EditAction::make()
->url(fn (Model $record) => PersonnelAssignmentResource::getUrl('edit', [$record])),