umbrellio / laravel-ltree
Extension LTree (Postgres) for Laravel
8.1.0
2025-06-03 22:46 UTC
Requires
- php: ^8.3|^8.4
- doctrine/dbal: ^3.0
- laravel/framework: ^11.0
- umbrellio/laravel-common-objects: *
- umbrellio/laravel-pg-extensions: ^7.2
Requires (Dev)
- orchestra/testbench: ^9.0
- php-coveralls/php-coveralls: ^2.1
- squizlabs/php_codesniffer: ^3.5
- umbrellio/code-style-php: ^1.0
This package is auto-updated.
Last update: 2026-05-22 19:16:49 UTC
README
LTree Extension (PostgreSQL) for Laravel.
Installation
Run this command to install:
php composer.phar require umbrellio/laravel-ltree
How to use
Implement your Eloquent\Model from LTreeModelInterface and use LTreeModelTrait.
Use LTreeService for build path:
- when create model:
createPath(LTreeModelInterface $model) - when update model:
updatePath(LTreeModelInterface $model)for update path for model and children - when delete model:
dropDescendants(LTreeModelInterface $model)for delete children models
The get() method returns LTreeCollection, instead of the usual Eloquent\Collection.
LTreeCollection has a toTree() method that converts a flat collection to a tree.
LTreeResourceCollection & LTreeResource, which take LTreeCollection as an argument, will also be useful.
Authors
Created by Korben Dallas.