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

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

jafar-akhondali/laravel-nestable
================================

Laravel 5 nested categories library

v0.8.9(7y ago)09MITPHPPHP &gt;=5.5.5

Since Apr 7Pushed 6y agoCompare

[ Source](https://github.com/JafarAkhondali/laravel-nestable)[ Packagist](https://packagist.org/packages/jafar-akhondali/laravel-nestable)[ Docs](https://github.com/atayahmet/nestable)[ RSS](/packages/jafar-akhondali-laravel-nestable/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependencies (5)Versions (47)Used By (0)

Laravel 5 Nestable
==================

[](#laravel-5-nestable)

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)

[![Build Status](https://camo.githubusercontent.com/62b8757e87b7bfed9e9e571a86c242bcf9ea7727dc1632c4408bce55cd1997da/68747470733a2f2f7472617669732d63692e6f72672f6174617961686d65742f6c61726176656c2d6e65737461626c652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/atayahmet/laravel-nestable)

Install
-------

[](#install)

```
composer require atayahmet/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:

```
