PHPackages                             dcblogdev/laravel-nestable - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. dcblogdev/laravel-nestable

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

dcblogdev/laravel-nestable
==========================

Laravel 5 nested categories library

v1.0.5(2y ago)61922MITPHPPHP &gt;=5.5.5CI failing

Since Jan 23Pushed 1y ago1 watchersCompare

[ Source](https://github.com/dcblogdev/laravel-nestable)[ Packagist](https://packagist.org/packages/dcblogdev/laravel-nestable)[ Docs](https://github.com/dcblogdev/laravel-nestable)[ GitHub Sponsors](https://github.com/dcblogdev)[ RSS](/packages/dcblogdev-laravel-nestable/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (6)Dependencies (5)Versions (8)Used By (0)

Laravel Nestable
================

[](#laravel-nestable)

Forked from  due to being archived and needing the package to support Laravel 6. Thanks to Ahmet for this package.

Laravel Nestable to work with recursive logic. Category level there is no limit but this may vary depending on your server performance. Allow the 100000 recursion process execution since PHP 5.2. [More info](http://php.net/manual/en/pcre.configuration.php#ini.pcre.recursion-limit)

Install
-------

[](#install)

```
composer require dcblogdev/laravel-nestable

```

Then

Add to **app.php** the Service Provider file.

```
Nestable\NestableServiceProvider::class

```

Then add **app.php** Facade file again.

```
'Nestable' => Nestable\Facades\NestableService::class

```

Finally run the artisan command:

```
php artisan vendor:publish --provider="Nestable\NestableServiceProvider"

```

That's it!

Basic Usage with Eloquent
-------------------------

[](#basic-usage-with-eloquent)

Suppose that the data came from a database as follows.

Category table:

idparent\_idnameslug10T-shirtst-shirts21Red T-shirtsred-t-shirts31Black T-shirtsblack-t-shirts40Sweaterssweaters54Red Sweatersred-sweaters64Blue Sweatersblue-sweatersExample 1:

```
