RegisterBlockSidebar::extendWith()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 19

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 19
rs 9.6333
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
namespace Modules\Block\Events\Handlers;
4
5
use Maatwebsite\Sidebar\Group;
6
use Maatwebsite\Sidebar\Item;
7
use Maatwebsite\Sidebar\Menu;
8
use Modules\Core\Sidebar\AbstractAdminSidebar;
9
10
class RegisterBlockSidebar extends AbstractAdminSidebar
11
{
12
    /**
13
     * Method used to define your sidebar menu groups and items
14
     * @param Menu $menu
15
     * @return Menu
16
     */
17
    public function extendWith(Menu $menu)
18
    {
19
        $menu->group(trans('core::sidebar.content'), function (Group $group) {
20
            $group->item(trans('block::blocks.title.blocks'), function (Item $item) {
21
                $item->authorize(
22
                    $this->auth->hasAccess('block.blocks.index')
23
                );
24
                $item->icon('fa fa-cube');
25
                $item->weight(config('asgard.block.config.sidebar-position', 15));
26
                $item->append('admin.block.block.create');
27
                $item->route('admin.block.block.index');
28
                $item->authorize(
29
                    $this->auth->hasAccess('block.blocks.index')
30
                );
31
            });
32
        });
33
34
        return $menu;
35
    }
36
}
37