| Conditions | 4 |
| Paths | 3 |
| Total Lines | 12 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 6 |
| CRAP Score | 4 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 19 | 83 | public function handle($request, Closure $next, $guard = null) |
|
| 20 | { |
||
| 21 | 83 | if (Auth::guard($guard)->guest()) { |
|
| 22 | 30 | if ($request->ajax() || $request->wantsJson()) { |
|
| 23 | 11 | return response('Unauthorized.', 401); |
|
| 24 | } else { |
||
| 25 | 19 | return redirect()->guest('login'); |
|
| 26 | } |
||
| 27 | } |
||
| 28 | |||
| 29 | 54 | return $next($request); |
|
| 30 | } |
||
| 31 | } |
||
| 32 |