PHPackages                             easydot/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. easydot/laravel-nestable

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

easydot/laravel-nestable
========================

Laravel 9 nested categories library

v1.0.8(2y ago)020MITPHPPHP &gt;=5.5.5

Since Jan 6Pushed 2y agoCompare

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

READMEChangelog (9)Dependencies (5)Versions (9)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 easydot/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:

```
