且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Laravel 4渴望加载以及类别,子类别,文章

更新时间:2022-01-05 06:19:23

您没有在寻找eager loading,需要解决如何管理数据库中的分层数据.

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

嵌套集模型很好地满足了这一目的.您应该在Wiki上阅读一些理论: http://en.wikipedia.org/wiki/Nested_set_model

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

幸运的是,已经有雄辩的实现.
提一下:
-Baum(***的免费软件,恕我直言), https://github.com/etrepat/baum
-Laravel嵌套集, https://github.com/atrauzzi/laravel-nested-set
-Laravel4-nestedset, https://github.com/lazychaser/laravel4-nestedset

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

和付费产品(当然也是最高质量的产品)
来自Cartalyst公司- https://cartalyst.com/manual/nested-sets

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