📜  laravel 中的延迟加载 - PHP 代码示例

📅  最后修改于: 2022-03-11 14:54:34.093000             🧑  作者: Mango

代码示例2
1. Eager Loading : Eager Loading helps you to load all your needed entities at once.
  i.e. related objects (child objects) are loaded automatically with its parent 
 object. Use Eager Loading when the relations are not too much. Thus, 
Eager Loading is a good practice to reduce further queries on the Server.
Use Eager Loading when you are sure that you will be using related entities with the main entity everywhere.
Lazy Loading: In case of lazy loading, related objects (child objects) are not loaded automatically with its parent object until they are requested. By default LINQ supports lazy loading.