Passed
Push — develop ( d2ded6...15ac65 )
by Nikita
19:39
created

AdminMiddleware::handle()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
dl 0
loc 7
ccs 4
cts 4
cp 1
rs 10
c 1
b 0
f 0
cc 2
nc 2
nop 2
crap 2
1
<?php
2
3
namespace Gameap\Http\Middleware;
4
5
use Closure;
6
use Illuminate\Support\Facades\Auth;
7
use Bouncer;
8
9
class AdminMiddleware
10
{
11
    /**
12
     * Handle an incoming request.
13
     *
14
     * @param  \Illuminate\Http\Request  $request
15
     * @param  \Closure  $next
16
     * @return mixed
17
     */
18 9
    public function handle($request, Closure $next)
19
    {
20 9
        if (!Bouncer::can('admin roles & permissions')) {
21 6
            abort('403', 'Access Denied');
22
        }
23
24 3
        return $next($request);
25
    }
26
}
27