Completed
Push — master ( 714c30...9cdd17 )
by Maxime
04:22
created

SetDisplayStatus   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A handle() 0 12 2
1
<?php
2
3
namespace Distilleries\Expendable\Http\Middleware;
4
5
use Closure;
6
use Illuminate\Contracts\Foundation\Application;
7
use Distilleries\Expendable\Helpers\UserUtils;
8
9
class SetDisplayStatus {
10
11
12
    protected $app;
13
    
14
    /**
15
     * Create a new filter instance.
16
     *
17
     */
18
    public function __construct(Application $app)
19
    {
20
        $this->app        = $app;
21
    }
22
23
    /**
24
     * Handle an incoming request.
25
     *
26
     * @param  \Illuminate\Http\Request $request
27
     * @param  \Closure $next
28
     * @return mixed
29
     */
30
    public function handle($request, Closure $next)
31
    {
32
33
        if (UserUtils::isBackendRole())
34
        {
35
            UserUtils::setDisplayAllStatus();
36
        }else{
37
            UserUtils::forgotDisplayAllStatus();
38
        }
39
40
        return $next($request);
41
    }
42
}