Add eager loading

How can I add the suggested eager loading?
Select::make('lease_id')
->required()
->label('Leases')
->relationship(
name: 'leaseitems',
titleAttribute: 'lease_id',
modifyQueryUsing: fn (Builder $query) => $query->orderBy('id'),
)
->getOptionLabelFromRecordUsing(fn (Model $record) => "Lease No. {$record->lease_id} - ID No. {$record->leaseholder->id_number} {$record->leaseholder->names}")
->searchable(['id_number', 'names'])
->preload()
->live(),
Select::make('lease_id')
->required()
->label('Leases')
->relationship(
name: 'leaseitems',
titleAttribute: 'lease_id',
modifyQueryUsing: fn (Builder $query) => $query->orderBy('id'),
)
->getOptionLabelFromRecordUsing(fn (Model $record) => "Lease No. {$record->lease_id} - ID No. {$record->leaseholder->id_number} {$record->leaseholder->names}")
->searchable(['id_number', 'names'])
->preload()
->live(),
No description
3 Replies
Want results from more Discord servers?
Add your server