Completed
Push — master ( 8d8912...06603f )
by Sebastian
03:51
created

BackMenus   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 50
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2
Metric Value
wmc 1
lcom 1
cbo 2
dl 0
loc 50
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A register() 0 47 1
1
<?php
2
3
namespace App\Services\Navigation\Menu;
4
5
use HTML;
6
use Spatie\Menu\Laravel\Link;
7
use Spatie\Menu\Laravel\Menu;
8
9
class BackMenus
10
{
11
    public function register()
12
    {
13
        Menu::macro('backMain', function () {
14
            return Menu::back()
15
                ->addClass('menu_groups')
16
                ->setAttribute('data-menu-groups')
17
                ->add(Menu::back()
18
                    ->addParentClass('menu_group -single')
19
                    ->add(
20
                        Link::action('Back\DashboardController@index', fragment('back.dashboard.title'))
21
                            ->addParentClass('menu_group_item')
22
                    )
23
                )
24
                ->add(Menu::moduleGroup('content')
25
                    ->module('NewsItemController@index', 'newsItems.title')
26
                    ->startSecondary()
27
                    ->module('PersonController@index', 'people.title')
28
                    ->module('ArticleController@index', 'articles.title')
29
                )
30
                ->add(Menu::moduleGroup('modules')
31
                    ->module('FormResponseController@showDownloadButton', 'formResponses.title')
32
                    ->startSecondary()
33
                    ->module('TagController@index', 'tags.title')
34
                    ->module('FragmentController@index', 'fragments.title')
35
                )
36
                ->add(Menu::moduleGroup('configuration')
37
                    ->module('FrontUserController@index', 'frontUsers.title')
38
                    ->module('BackUserController@index', 'backUsers.title')
39
                    ->startSecondary()
40
                    ->module('ActivitylogController@index', 'log.title')
41
                    ->module('StatisticsController@index', 'statistics.menuTitle')
42
                );
43
        });
44
45
        Menu::macro('backUser', function () {
46
47
            $avatar = HTML::avatar(auth()->user(), '-small') .
0 ignored issues
show
Bug introduced by
The method user() does not seem to exist on object<Illuminate\Contracts\Auth\Factory>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
48
                el('span.:response-desktop-only', auth()->user()->email);
0 ignored issues
show
Bug introduced by
The method user() does not seem to exist on object<Illuminate\Contracts\Auth\Factory>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
49
50
            return Menu::new()
51
                ->add(Link::action('Back\BackUserController@edit', $avatar, [current_user()->id]))
52
                ->add(Link::action('Back\AuthController@getLogout', el('span.fa.fa-power-off'))
53
                    ->addClass('menu_circle -log-out')
54
                    ->setAttribute('title', 'log out')
55
                );
56
        });
57
    }
58
}
59