Answer the question
In order to leave comments, you need to log in
When to use lazy Loading and Eager Loading in Laravel?
Can you please explain when to use lazy Loading and Eager Loading in Laravel?
Answer the question
In order to leave comments, you need to log in
lazy loading is used by default, when you access some kind of connection through a model object, then when you request this connection, a request to the database will be executed.
Eager loading is used when they know for sure that connections will be needed and the necessary connections are indicated in the request of the model from which they need to be obtained.
In this case, your object will already have model objects from the links that you specify in with ().
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question