Conditions | 4 |
Paths | 3 |
Total Lines | 12 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 20 |
Changes | 3 | ||
Bugs | 1 | Features | 2 |
1 | <?php namespace App\Http\Middleware; |
||
34 | public function handle(Request $request, \Closure $next) |
||
35 | { |
||
36 | if (app('sentinel')->guest()) { |
||
37 | if ($request->ajax() || $request->wantsJson()) { |
||
38 | throw new UnauthorizedHttpException('Unauthorized'); |
||
39 | } else { |
||
40 | return redirect()->guest(route('login')); |
||
41 | } |
||
42 | } |
||
43 | |||
44 | return $next($request); |
||
45 | } |
||
46 | } |
||
47 |