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?
CheersSolution:Jump to 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()
...4 Replies
I think filament will eager load the relation if founded in the
::make('user.name')
That's the way I normally do it. The problem is I need to access multiple attributes of the relationship in this view.
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()
You were right, using dot notation to set any relationship attribute makes the whole relationship available in the view! Thanks π