AdminAuth   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 11
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 5
c 1
b 0
f 1
dl 0
loc 11
rs 10
wmc 4

1 Method

Rating   Name   Duplication   Size   Complexity  
A handle() 0 9 4
1
<?php
2
3
namespace App\Http\Middleware;
4
5
use Auth;
6
use Closure;
7
8
class AdminAuth
9
{
10
    public function handle($request, Closure $next)
11
    {
12
        if (Auth::check()) {
13
            if ($request->user()->isAdmin() || $request->user()->isModerator()) {
14
                return $next($request);
15
            }
16
        }
17
18
        abort(403);
19
    }
20
}
21