Blog

Eager Loading in Filament Admin

Filament normally handles eager loading out of the box. If you have a special case, where you manually want to eager load a relation, you can use this code:

public static function getEloquentQuery(): Builder
{
	return parent::getEloquentQuery()->with('translations'); 
}

Add this code to your Resource class and the relation (in this case translations) will be eager loaded.