Conditions | 3 |
Paths | 3 |
Total Lines | 14 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Tests | 3 |
CRAP Score | 3 |
Changes | 0 |
1 | <?php namespace App\Http\Middleware; |
||
18 | public function handle($request, \Closure $next, ...$guards) |
||
19 | { |
||
20 | try { |
||
21 | 1 | $this->authenticate($guards); |
|
22 | } catch (AuthenticationException $e) { |
||
23 | 1 | if ($request->expectsJson()) { |
|
24 | 1 | throw $e; |
|
25 | } else { |
||
26 | return redirect()->guest(route('login')); |
||
27 | } |
||
28 | } |
||
29 | |||
30 | return $next($request); |
||
31 | } |
||
32 | } |
||
33 |