Laravel 4 eager loading and categories, subcategories, articles

微笑、不失礼 提交于 2019-12-04 20:42:39

You are not looking for eager loading, you need to solve how to manage hierarchical data in your database.

Nested sets model serves this purpose very well. You should read some theory on Wiki: http://en.wikipedia.org/wiki/Nested_set_model

Fortunately, there are Eloquent implementations already.
To mention some:
- Baum (the best free, imho), https://github.com/etrepat/baum
- Laravel Nested Set, https://github.com/atrauzzi/laravel-nested-set
- Laravel4-nestedset, https://github.com/lazychaser/laravel4-nestedset

and the paid one (surely highest quality as well)
from Cartalyst company - https://cartalyst.com/manual/nested-sets

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!