Disable single query loading in Eloquent ORM

While working on optimizing some queries, I found code that would load a large number of entities, grab their IDs and discard everything else. This causes errors / lengthy queries, while Eloquent eagerly loads all the relationships for those objects.

Since I know there is no need for linked objects in this case, I want to temporarily disable eager loading.

Is there a way to disable eager loading of the request?

+3


source to share


1 answer


Bright, only hot loads when you talk about it (usually using the with () function when building a query). I missed where elses user code was adding all relationships with



0


source







All Articles