F
Filament8mo ago
Oddman

How to link to a resource from a repeater entry?

I'm listing articles an author has published under the repeater entry, and can't work out how to link to the article they authored.
Solution:
you can do this
TextEntry::make('field')
->url(fn ($record): string => YourResource::getUrl('edit', ['record' => $record->id]))
TextEntry::make('field')
->url(fn ($record): string => YourResource::getUrl('edit', ['record' => $record->id]))
...
Jump to solution
6 Replies
LeandroFerreira
LeandroFerreira8mo ago
share your code please
Oddman
Oddman8mo ago
@Leandro Ferreira there's nothing to share, I have no idea how to do it 🙂 How do you link to a related resource?
LeandroFerreira
LeandroFerreira8mo ago
->url(fn($record):string => ...) Or using formatStateUsing?
Oddman
Oddman8mo ago
Oh there’s no generator method or anything? I thought there'd be something like: TextInput::make('category')->linkToResource() .etc.
Solution
LeandroFerreira
LeandroFerreira8mo ago
you can do this
TextEntry::make('field')
->url(fn ($record): string => YourResource::getUrl('edit', ['record' => $record->id]))
TextEntry::make('field')
->url(fn ($record): string => YourResource::getUrl('edit', ['record' => $record->id]))
Oddman
Oddman8mo ago
Ah, cool. ty 🙂