Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/umbrellio/laravel-ltree
LTree Extension (PostgreSQL) for Laravel
https://github.com/umbrellio/laravel-ltree
extension laravel laravel-ltree ltree ltree-extension pgsql php postgres postgresql tree
Last synced: 28 days ago
JSON representation
LTree Extension (PostgreSQL) for Laravel
- Host: GitHub
- URL: https://github.com/umbrellio/laravel-ltree
- Owner: umbrellio
- License: mit
- Created: 2019-07-13T15:19:50.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2024-05-16T14:01:26.000Z (6 months ago)
- Last Synced: 2024-09-28T18:21:45.081Z (about 1 month ago)
- Topics: extension, laravel, laravel-ltree, ltree, ltree-extension, pgsql, php, postgres, postgresql, tree
- Language: PHP
- Homepage:
- Size: 289 KB
- Stars: 33
- Watchers: 6
- Forks: 8
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# laravel-ltree
[![Github Status](https://github.com/umbrellio/laravel-ltree/workflows/CI/badge.svg)](https://github.com/umbrellio/laravel-ltree/actions)
[![Coverage Status](https://coveralls.io/repos/github/umbrellio/laravel-ltree/badge.svg?branch=master)](https://coveralls.io/github/umbrellio/laravel-ltree?branch=master)
[![Latest Stable Version](https://poser.pugx.org/umbrellio/laravel-ltree/v/stable.png)](https://packagist.org/packages/umbrellio/laravel-ltree)
[![Total Downloads](https://poser.pugx.org/umbrellio/laravel-ltree/downloads.png)](https://packagist.org/packages/umbrellio/laravel-ltree)
[![Code Intelligence Status](https://scrutinizer-ci.com/g/umbrellio/laravel-ltree/badges/code-intelligence.svg?b=master)](https://scrutinizer-ci.com/code-intelligence)
[![Build Status](https://scrutinizer-ci.com/g/umbrellio/laravel-ltree/badges/build.png?b=master)](https://scrutinizer-ci.com/g/umbrellio/laravel-ltree/build-status/master)
[![Code Coverage](https://scrutinizer-ci.com/g/umbrellio/laravel-ltree/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/umbrellio/laravel-ltree/?branch=master)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/umbrellio/laravel-ltree/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/umbrellio/laravel-ltree/?branch=master)LTree Extension (PostgreSQL) for Laravel.
## Installation
Run this command to install:
```bash
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 modelsThe `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.