SidebarExtender   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 2
lcom 1
cbo 4
dl 0
loc 38
rs 10
c 2
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A extendWith() 0 15 1
1
<?php namespace Modules\Setting\Sidebar;
2
3
use Maatwebsite\Sidebar\Group;
4
use Maatwebsite\Sidebar\Item;
5
use Maatwebsite\Sidebar\Menu;
6
use Modules\Core\Contracts\Authentication;
7
8
class SidebarExtender implements \Maatwebsite\Sidebar\SidebarExtender
9
{
10
    /**
11
     * @var Authentication
12
     */
13
    protected $auth;
14
15
    /**
16
     * @param Authentication $auth
17
     *
18
     * @internal param Guard $guard
19
     */
20
    public function __construct(Authentication $auth)
21
    {
22
        $this->auth = $auth;
23
    }
24
25
    /**
26
     * @param Menu $menu
27
     *
28
     * @return Menu
29
     */
30
    public function extendWith(Menu $menu)
31
    {
32
        $menu->group(trans('workshop::workshop.title'), function (Group $group) {
33
            $group->item(trans('setting::settings.title.settings'), function (Item $item) {
34
                $item->icon('fa fa-cog');
35
                $item->weight(50);
36
                $item->route('admin.setting.settings.index');
37
                $item->authorize(
38
                    $this->auth->hasAccess('setting.settings.index')
39
                );
40
            });
41
        });
42
43
        return $menu;
44
    }
45
}
46