umbrellio / laravel-ltree
Laravel 的 LTree (Postgres) 扩展
8.0.1
2024-05-16 10:10 UTC
Requires
- php: ^8.3|^8.4
- doctrine/dbal: ^3.0
- laravel/framework: ^11.0
- umbrellio/laravel-common-objects: *
- umbrellio/laravel-pg-extensions: ^7.0
Requires (Dev)
- orchestra/testbench: ^9.0
- php-coveralls/php-coveralls: ^2.1
- squizlabs/php_codesniffer: ^3.5
- umbrellio/code-style-php: ^1.0
- dev-master
- 8.0.1
- 8.0.0
- 7.5.2
- 7.5.1
- 7.5.0
- 7.4.4
- 7.4.3
- 7.4.2
- 7.4.1
- 7.4.0
- 7.3.0
- 7.2.3
- 7.2.2
- 7.2.1
- 7.2.0
- 7.1.0
- 7.0.0
- 6.8.4
- 6.8.3
- 6.8.2
- 6.8.1
- 6.7.0
- 6.6.0
- 6.5.0
- 6.4.0
- 6.3.0
- 6.2.0
- 6.1.0
- 6.0.3
- 6.0.2
- 6.0.1
- 6.0.0
- 5.3.1
- 5.3.0
- 5.2.0
- 5.1.0
- 5.0.0
- 4.2.0
- 4.1.2
- 4.1.1
- 4.1.0
- 4.0.2
- 4.0.1
- 3.9.0
- 3.8.1
- 3.8.0
- 3.7.0
- 3.6.2
- 3.6.1
- 3.6.0
- 3.5.1
- 3.5.0
- 3.4.0
- 3.3.1
- 3.3.0
- 3.2.0
- 3.1.0
- 3.0.0
- 2.1.0
- 2.0.0
- 1.2.0
- 1.1.3
- 1.1.1
- 1.1.0
- 1.0.0.1
- 1.0.0
- dev-bug-with-leaves-php8.2
- dev-bug-with-leaves
- dev-issue/key-interface
This package is auto-updated.
Last update: 2024-09-16 15:03:02 UTC
README
Laravel 的 LTree 扩展 (PostgreSQL)
安装
运行以下命令进行安装
php composer.phar require umbrellio/laravel-ltree
使用方法
从 LTreeModelInterface
实现 Eloquent\Model
并使用 LTreeModelTrait
。
使用 LTreeService 来构建路径
- 当创建模型时:
createPath(LTreeModelInterface $model)
- 当更新模型时:
updatePath(LTreeModelInterface $model)
用于更新模型及其子模型的路径 - 当删除模型时:
dropDescendants(LTreeModelInterface $model)
用于删除子模型
get()
方法返回 LTreeCollection
,而不是常用的 Eloquent\Collection
。
LTreeCollection
有一个 toTree()
方法,可以将平面集合转换为树形结构。
LTreeResourceCollection
和 LTreeResource
,它们接受 LTreeCollection
作为参数,也将非常有用。
作者
由 Korben Dallas 创建。