Completed
Pull Request — master (#14)
by Fèvre
29:13 queued 20:34
created

MenuServiceProvider   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A boot() 0 21 1
1
<?php
2
namespace Xetaravel\Providers;
3
4
use Illuminate\Support\ServiceProvider;
5
use Spatie\Menu\Laravel\MenuFacade as Menu;
6
use Spatie\Menu\Laravel\Link;
7
8
class MenuServiceProvider extends ServiceProvider
9
{
10
    /**
11
     * Bootstrap any application services.
12
     *
13
     * @return void
14
     */
15
    public function boot()
16
    {
17
        Menu::macro('userProfile', function () {
18
            return Menu::new()
19
                ->addClass('nav nav-menu flex-column')
20
                ->setAttribute('role', 'navigation')
21
                ->add(
22
                    Link::toRoute('users.account.index', '<i class="fa fa-user"></i> Account')
23
                        ->addClass('nav-link')
24
                )
25
                ->add(
26
                    Link::toRoute('users.notification.index', '<i class="fa fa-bell-o"></i> Notifications')
27
                        ->addClass('nav-link')
28
                )
29
                ->add(
30
                    Link::toRoute('users.user.settings', '<i class="fa fa-cogs"></i> Settings')
31
                        ->addClass('nav-link')
32
                )
33
                ->setActiveFromRequest();
34
        });
35
    }
36
}
37