mercredi 28 septembre 2016

Admin LTE with Laratrust

I'm using Laratrust and try implements: I created these files

App\MyMenuFilter.php

<?php

namespace App;

use JeroenNoten\LaravelAdminLte\Menu\Builder;
use JeroenNoten\LaravelAdminLte\Menu\Filters\FilterInterface;

class MyMenuFilter implements FilterInterface
{
    public function transform($item, Builder $builder)
    {
        if (isset($item['permission']) && Laratrust::can($item['permission'])) {
            return false;
        }

        return $item;
    }
}

I changed this config\adminlte.php

'menu' => [
    'MAIN NAVIGATION',
    [
        'text' => 'Blog',
        'url'  => 'admin/blog',
        'permission'  => 'create-post', // Here
    ],
    #code
]

'filters' => [
    #code
    //JeroenNoten\LaravelAdminLte\Menu\Filters\GateFilter::class,
    App\MyMenuFilter::class,
],

But show this error:

Class 'App\Laratrust' not found (View: /var/www/html/multi-auth/vendor/jeroennoten/laravel-adminlte/resources/views/page.blade.php)



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire