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