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

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

webreinvent/laravel-nestable
============================

Laravel 8 nested categories library

0.0.3(5y ago)822.0k↓44.4%22MITPHPPHP ^7.3|^8.0

Since Sep 16Pushed 5y ago2 watchersCompare

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

READMEChangelog (3)Dependencies (3)Versions (6)Used By (2)

Laravel 8 Nestable
==================

[](#laravel-8-nestable)

### Info:

[](#info)

> This repository is a clone of [Laravel Nestable](https://github.com/atayahmet/laravel-nestable) which is "Archived" by the developer. We'll try to maintain it as much as possible for future releases of Laravel.

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 webreinvent/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:

```
