F
Filament13mo 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
LeandroFerreira13mo ago
share your code please
Oddman
OddmanOP13mo 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
LeandroFerreira13mo ago
->url(fn($record):string => ...) Or using formatStateUsing?
Oddman
OddmanOP13mo ago
Oh there’s no generator method or anything? I thought there'd be something like: TextInput::make('category')->linkToResource() .etc.
Solution
LeandroFerreira
LeandroFerreira13mo 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
OddmanOP13mo ago
Ah, cool. ty 🙂
Want results from more Discord servers?
Add your server