ComposerServiceProvider   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 2
c 0
b 0
f 0
lcom 0
cbo 3
dl 0
loc 36
ccs 0
cts 17
cp 0
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A boot() 0 18 1
A register() 0 4 1
1
<?php
2
3
namespace SET\Providers;
4
5
use Illuminate\Support\Facades\Auth;
6
use Illuminate\Support\ServiceProvider;
7
use SET\Duty;
8
use SET\Setting;
9
use SET\TrainingType;
10
use SET\User;
11
12
class ComposerServiceProvider extends ServiceProvider
13
{
14
    /**
15
     * Bootstrap the application services.
16
     *
17
     * @return void
18
     */
19
    public function boot()
20
    {
21
        view()->composer(['layouts.master'], function ($view) {
22
            $view->with('app_name', Setting::get('app_name', 'SET'));
23
        });
24
25
        // Pass the logged in user's full name to the layouts._header view.
26
        view()->composer(['layouts._navbar', 'home._last_login'], function ($view) {
27
            $view->with('logged_in_user', Auth::user());
28
            $view->with('duties', Duty::all());
29
            $view->with('trainingTypes', TrainingType::where('status', '1')
30
                    ->select('id', 'name')->orderBy('name')->get());
31
            $view->with('userStatus', User::distinct()->orderBy('status')->get(['status']));
32
        });
33
34
        // Pass our action items if we have the sidebar.
35
        view()->composer('layouts._sidebar_action_items', 'SET\Http\ViewComposers\ActionItemsComposer');
36
    }
37
38
    /**
39
     * Register the application services.
40
     *
41
     * @return void
42
     */
43
    public function register()
44
    {
45
        //
46
    }
47
}
48