F
Filament6mo ago
Sythe

Editing related models in their own Resource

I have a RelationManager in a Resource. The relation also has it's own resource, but I use the RelationManager for convienience, so it's easy to see which records are nested inside a model. Now I want the EditAction to redirect to it's own Resource page. I do it like this:
->actions([
Tables\Actions\Action::make('edit')->url(route('filament.admin.resources.modules.edit', ['record' => $record])),
Tables\Actions\DeleteAction::make(),
])
->actions([
Tables\Actions\Action::make('edit')->url(route('filament.admin.resources.modules.edit', ['record' => $record])),
Tables\Actions\DeleteAction::make(),
])
But $record is not the right variable. I tried several things, but I can't find the solution. Two questions: - Is this the right way to do, or is there a simpler solution? - What is the right variable?
Solution:
Sorry, for posting, but this was the answer: Tables\Actions\Action::make('edit')->url(fn($record): string => route('filament.admin.resources.modules.edit', [$record->id])),...
Jump to solution
1 Reply
Solution
Sythe
Sythe6mo ago
Sorry, for posting, but this was the answer: Tables\Actions\Action::make('edit')->url(fn($record): string => route('filament.admin.resources.modules.edit', [$record->id])),
Want results from more Discord servers?
Add your server