PHP code example of tacone / rapyd-datatree

1. Go to this page and download the library: Download tacone/rapyd-datatree 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/ */

    

tacone / rapyd-datatree example snippets


use Tacone\RapydDataTree\DataTree;

class MyController extends Controller
{
    public function anyIndex($rootId = null)
    {
        $rootId or App::abort(404);
        $root = Menu::find($rootId) or App::abort(404);

        $tree = DataTree::source($root);
        $tree->add('title');
        $tree->edit("/admin/menu/edit", 'Edit', 'modify|delete');

        return View::make('admin/menu/index', compact('tree'));
    }
}