Skip to content

4.13.64-beta

Compare
Choose a tag to compare
@butschster butschster released this 26 Feb 19:51
· 2655 commits to development since this release
  • Added navigation checking access rights
    You can set global access rights rules
AdminNavigation::setAccessLogic(function(Page $page) {
   return auth()->user()->isSuperAdmin();
});

or by section

AdminNavigation::addPage(...)->setAccessLogic(...)->setPages(function(Page $page) {

});

or by page

AdminNavigation::addPage(...)->setAccessLogic(...)->seturl(...);
  • Nagigation can be build from array

app/Admin/navigation.php

AdminNavigation::setAccessLogic(function(Page $page) {
       return auth()->user()->isSuperAdmin();
});

AdminNavigation::addPage(\App\User::class)->setTitle('test')->setPages(function(Page $page) {
      $page
          ->addPage()
          ->setTitle('Dashboard')
          ->setUrl(route('admin.dashboard'))
          ->setPriority(100);

      $page->addPage(\App\User::class);
});

return [
    [
        'title' => 'Dashboard',
        'icon'  => 'fa fa-dashboard',
        'url'   => route('admin.dashboard'),
    ],

    [
        'title' => 'Information',
        'icon'  => 'fa fa-exclamation-circle',
        'url'   => route('admin.information'),
    ],
    [
        'title' => 'Content',
        'pages' => [

            \App\User::class,

            (new Page(\App\User::class))
                ->setPriority(100)
                ->setIcon('fa fa-user')
                ->setUrl('users')
                ->setAccessLogic(function (Page $page) {
                    return auth()->user()->isSuperAdmin();
            }),

            new Page([
                'title'    => 'News',
                'priority' => 200,
                'model'    => \App\News::class
            ]),

            (new Page(/* ... */))->setPages(function (Page $page) {
                $page->addPage([
                    'title'    => 'Blog',
                    'priority' => 100,
                    'model'    => \App\Blog::class
                ));

                $page->addPage(\App\Blog::class);
            }),

            [
                'title'       => 'News',
                'priority'    => 300,
                'accessLogic' => function ($page) {
                    return $page->isActive();
                },
                'pages'       => [
                    // ...
                ]
            ]
        ]
     ]
];
  • Fixed routes
  • Renamed BaseDateTime to DateTime