LaravelPackages.net
Acme Inc.
Toggle sidebar
day4/tree-view

A Laravel Nova tool.

92.336
9
0.5.1
About day4/tree-view

day4/tree-view is a Laravel package for a laravel nova tool.. It currently has 9 GitHub stars and 92.336 downloads on Packagist (latest version 0.5.1). Install it with composer require day4/tree-view. Discover more Laravel packages by day4 or browse all Laravel packages to compare alternatives.

Last updated

‼️ This repository is no longer maintained by the original author. PRs are still welcome, but active support is limited

Nova Tree View

Display a model in a Tree View with drag and drop functionality. Useful for category structure.

Setup

Make sure your model you wish to use in the tree structure has the following columns:

parent_id
is_active
order

Add the tool to NovaServiceProvider.php

Category Model Example:

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);
});

Usage

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

Star History Chart