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