F
Filament3mo ago
HL

In my table's getEloquentQuery() method should I eager load relations?

I know if I use the dot notation like TextColumn::make('game.id') it will automatically eager load, but if I do this:
TextColumn::make('service')
->description(fn (Model $record) => $record->details->nickname)
TextColumn::make('service')
->description(fn (Model $record) => $record->details->nickname)
with the details relation, should I eager load the details relation in the tables getEloquentQuery() method? Should this be a common practice?
Solution:
should I eager load the details relation in the tables getEloquentQuery() method?
Yes.
Should this be a common practice?
Yes....
Jump to solution
2 Replies
Solution
dissto
dissto3mo ago
should I eager load the details relation in the tables getEloquentQuery() method?
Yes.
Should this be a common practice?
Yes.
HL
HL3mo ago
Thank you very much, pretty clear answer:)