Download the PHP package dcblogdev/laravel-nestable without Composer

On this page you can find all versions of the php package dcblogdev/laravel-nestable. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-nestable

Laravel Nestable

Forked from https://github.com/atayahmet/laravel-nestable 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

Install

Then

Add to app.php the Service Provider file.

Then add app.php Facade file again.

Finally run the artisan command:

That's it!

Basic Usage with Eloquent

Suppose that the data came from a database as follows.

Category table:

id parent_id name slug
1 0 T-shirts t-shirts
2 1 Red T-shirts red-t-shirts
3 1 Black T-shirts black-t-shirts
4 0 Sweaters sweaters
5 4 Red Sweaters red-sweaters
6 4 Blue Sweaters blue-sweaters

Example 1:

Note: $parent variable refers to the parent category (Default parent_id)

Query result:

For html tree output:

Output:

For dropdown output:

Output:

Selected for multiple list box:

Output methods

name Parameter output
renderAsArray() none array
renderAsJson() none json
renderAsHtml() none html
renderAsDropdown() none dropdown
renderAsMultiple() none Listbox

Usable methods with output methods

renderAsArray()

name paremeter description
parent() int Get childs of the defined parent

renderAsJson()

name paremeter description
parent() int Get childs of the defined parent

renderAsHtml()

name paremeter description
parent() int Get childs of the defined parent
active() callback/array/int Selected item(s) for html output
ulAttr() array/string Add attribute to parent ul element
firstUlAttr() array/string Add attribute to parent ul element
route() callback/array Generate url by route name
customUrl() string Generate custom url

renderAsDropdown()/renderAsMultiple()

name paremeter description
parent() int Get childs of the defined parent
selected() callback/array/int Selected item(s) for dropdown
attr() array Dropdown/listbox attributes

parent()

Get childs of the defined parent.

Note: This methods usable all with output methods

active()

Selected item(s) for html output.

Example 1:

Example 2:

Example 3:

Example 4:

Example 5:

firstUlAttr()

Add attribute to first ul element

Example 1:

Example 2:

ulAttr()

Add attribute to parent ul element

Example 1:

Example 2:

Example 3:

route()

Generate url by route name

Example 1:

Note: product refer to route name and slug refer to paremeter name.

Example 2:

customUrl()

Generate custom url with slug

Example 1:

Example 1:

Note: slug keyword belongs to html > href in config file.

selected()

Selected item(s) for dropdown.

Example 1:

Example 2:

Example 3:

Example 4:

attr()

Dropdown/listbox attributes.

Configuration

The above examples were performed with default settings. Config variables in config/nestable.php file.

name type description
parent string Parent category column name
primary_key string Table primary key
generate_url boolean Generate the url for html output
childNode string Child node name
body array Array output (default)
html array Html output columns
dropdown array Dropdown/Listbox output

body

The body variable should be an array and absolutely customizable.

Example:

html

Configuration for html output.

name description
label Label column name
href Url column name

Example:

dropdown

Configuration for dropdown/listbox output.

name description
prefix Label prefix
label Label column name
value Value column name

Example:

Using Independent Models

Include the Nestable facade.

For array output:

Validators

It controls the structure of the data. They also made the rendering process with a second parameter control after they.

name Parameters
isValidForArray boolean
isValidForJson boolean
isValidForHtml boolean
isValidForDropdown boolean
isValidForMultiple boolean

Example 1:

Example 2:

Macros

Call the above macro:

Helper


All versions of laravel-nestable with dependencies

PHP Build Version
Package Version
Requires php Version >=5.5.5
illuminate/support Version 5.2.*|5.3.*|5.4.*|5.5.*|5.6.*|5.7.*|5.8.*|6.*|7.*|8.*|9.*|10.*|11.*
illuminate/database Version 5.2.*|5.3.*|5.4.*|5.5.*|5.6.*|5.7.*|5.8.*|6.*|7.*|8.*|9.*|10.*|11.*
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package dcblogdev/laravel-nestable contains the following files

Loading the files please wait ....