| Conditions | 3 |
| Paths | 3 |
| Total Lines | 14 |
| Code Lines | 8 |
| Lines | 7 |
| Ratio | 50 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 42 | public function handle($request, Closure $next) |
||
| 43 | { |
||
| 44 | if ($this->auth->guest()) { |
||
| 45 | View Code Duplication | if ($request->ajax()) { |
|
| 46 | $result = ['fails' => 'Unauthorized! Please login again']; |
||
| 47 | |||
| 48 | return response()->json(compact('result')); |
||
| 49 | } else { |
||
| 50 | return redirect()->guest('auth/login'); |
||
| 51 | } |
||
| 52 | } |
||
| 53 | |||
| 54 | return $next($request); |
||
| 55 | } |
||
| 56 | } |
||
| 57 |
Adding a
@returnannotation to a constructor is not recommended, since a constructor does not have a meaningful return value.Please refer to the PHP core documentation on constructors.