tacone/rapyd-datatree

There is no license information available for the latest version (0.1.1) of this package.

Installs: 11

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 3

Forks: 0

Open Issues: 0

Language:JavaScript

0.1.1 2015-12-03 21:29 UTC

This package is not auto-updated.

Last update: 2024-11-09 18:17:00 UTC


README

If you use Laravel 5 you don't need this repository, the datatree has been merged in the core of Rapyd!

If you use Laravel 4.2 and Rapyd you can use this repo to add the DataTree to your app.

Installation

Before beginning, you need to add to your composer Baum\Baum as we don't add it automatically for you.

Add it to composer, add the service provider and publish the assets.

Add the service provider to app.php

        'Tacone\RapydDataTree\RapydDataTreeServiceProvider',

Add the css and js hooks in your template:

In the <head>:

    {{ DataTree::styles() }}

At the end of the <body>:

    {{ DataTree::scripts() }}

Sample usage

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