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

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

yhanndaniel/laravel-nestable
============================

Laravel 6 nested categories library

1219.6kPHP

Since Oct 28Pushed 5y agoCompare

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

READMEChangelogDependenciesVersions (1)Used By (0)

Laravel 6 Nestable
==================

[](#laravel-6-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:

```
