F
Filament13mo ago
msalehi

Column with relationship link to related resource

Hey there, i want to have a TextColumn that related to a resource, for example:
TextColumn::make('user.name')
TextColumn::make('user.name')
how do i relate the column to related resource using a link ? (By clicking on the name, the user can be directed to its page.)
Solution:
you can do ```php TextColumn::make('user.name') ->url(fn($record): string => UserResource::getUrl('view',['record'=>$record->user->id])),...
Jump to solution
1 Reply
Solution
Lara Zeus
Lara Zeus13mo ago
you can do
TextColumn::make('user.name')
->url(fn($record): string => UserResource::getUrl('view',['record'=>$record->user->id])),
TextColumn::make('user.name')
->url(fn($record): string => UserResource::getUrl('view',['record'=>$record->user->id])),
Want results from more Discord servers?
Add your server