Using eager loaded relationships in custom table column views

Hi all I have a custom table column that needs to use relationship data. I can access data using $getRecord()->user()->name . The problem is this isn't eager loaded so I get an extra query for every table row. Any ideas how I can solve that? Cheers
Solution:
I mean you add the dot with the relation I think all the record will be available! havent tested that case actually you can always override the query and add with()...
Jump to solution
4 Replies
Lara Zeus
Lara Zeus13mo ago
I think filament will eager load the relation if founded in the ::make('user.name')
binaryfire
binaryfireOP13mo ago
That's the way I normally do it. The problem is I need to access multiple attributes of the relationship in this view.
Solution
Lara Zeus
Lara Zeus13mo ago
I mean you add the dot with the relation I think all the record will be available! havent tested that case actually you can always override the query and add with()
binaryfire
binaryfireOP13mo ago
You were right, using dot notation to set any relationship attribute makes the whole relationship available in the view! Thanks 🙂

Did you find this page helpful?