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