Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想获得一个具有选定关系的集合或数组作为子集合:
$user = User::findOrFail($id); $user->box()->boxtype()->get();
由于 User 与 Box 具有多对多关系,并且 Box 与 BoxType 具有多对多关系,因此我想获得一个集合,它将所有 BoxType 结果嵌入到 Box 结果集合中。
在 Laravel 文档中阅读有关预加载的信息。也急切的负载约束。