Skip to content

LTree Extension (PostgreSQL) for Laravel

License

Notifications You must be signed in to change notification settings

noor-tg/laravel-ltree

 
 

Repository files navigation

laravel-ltree

Github Status Coverage Status Latest Stable Version Total Downloads Code Intelligence Status Build Status Code Coverage Scrutinizer Code Quality

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:

  1. when create model: createPath(LTreeModelInterface $model)
  2. when update model: updatePath(LTreeModelInterface $model) for update path for model and children
  3. 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.

Supported by Umbrellio

About

LTree Extension (PostgreSQL) for Laravel

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 99.3%
  • Shell 0.7%