PHP code example of gekich / nested-tree-filter

1. Go to this page and download the library: Download gekich/nested-tree-filter library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

gekich / nested-tree-filter example snippets


use Gekich\NestedTreeFilter\NestedTreeFilter;

class CategoryFilter extends NestedTreeFilter 
{
//
}


class CategoryFilter extends NestedTreeFilter
{
    public $filterModel = \App\Category::class; // - nested tree model 
    public $filterRelation = 'categories'; // - relation that filter uses
    public $name = 'Categories filter'; // - filter name
    public $idKey = 'id'; // - id column
    public $labelKey = 'name'; // - label column name
}
 
    public $placeholder = 'Select...'; 
 
    public $multiple = true;

use App\Nova\Filters\CategoryFilter;
   
class Product extends Resource
{
..
    public function filters(Request $request)
    {
        return [
            CategoryFilter::make()
        ];
    }

php artisan nova:filter CategoryFilter