F
Filament•9mo ago
LozzaJ

How to access row data in relationship manager

I want to make column visible based on field value but cannot work out what to use? I have tried ->visible(function($record) {... but $record is null Thanks in advance 🙂
6 Replies
Dennis Koch
Dennis Koch•9mo ago
This has been asked numerous times already. It’s not possible because it doesn’t make sense to hide columns per row
LozzaJ
LozzaJOP•9mo ago
Maybe I am not explaining correctly - I have a row which may or may not have a related item (seat number) - I am displaying a link on this table row "Change Seat" with a custom link - which I only want to appear if the seat number exists.
LeandroFerreira
LeandroFerreira•9mo ago
->formatStateUsing(fn ($state) => $state ? '<a href="#">Change Seat</a>' : '')
->html()
->formatStateUsing(fn ($state) => $state ? '<a href="#">Change Seat</a>' : '')
->html()
?
Dennis Koch
Dennis Koch•9mo ago
That should be enough ->url(fn ($state) => filled($state) ? 'Your url' : null)
LeandroFerreira
LeandroFerreira•9mo ago
I recommend using formatStateUsing because if you are utilizing the url property, the row value would correspond to the seat_number, rather than the text "Change Seat."
LozzaJ
LozzaJOP•9mo ago
Thanks guys, I'll give those a go today
Want results from more Discord servers?
Add your server