PHP code example of crayon / nova-treeview

1. Go to this page and download the library: Download crayon/nova-treeview 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/ */

    

crayon / nova-treeview example snippets


Schema::create('categories', function (Blueprint $table) {
    $table->unsignedInteger('id')->autoIncrement();
    $table->string('title');
    $table->string('slug');
    $table->unsignedInteger('parent_id')->nullable();
    $table->boolean('is_active')->default(true);
    $table->tinyInteger('order')->default(0);
});

/app/Providers/NovaServiceProvider.php
...
use Day4\TreeView\TreeView;
    ...
    public function tools()
    {
        return [
            ...
            new TreeView([
             // ['NAME_IN_SIDEBAR', 'TABLE_NAME']
                ['Categories', 'categories']
            ])
        ];
    }