| Conditions | 3 |
| Paths | 3 |
| Total Lines | 14 |
| Code Lines | 6 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 12 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php namespace Distilleries\Expendable\Http\Middleware; |
||
| 35 | public function handle($request, Closure $next) |
||
| 36 | { |
||
| 37 | if ($this->auth->guest()) |
||
| 38 | { |
||
| 39 | if ($request->ajax()) |
||
| 40 | { |
||
| 41 | return response('Unauthorized.', 401); |
||
| 42 | } else |
||
| 43 | { |
||
| 44 | return redirect()->guest($this->config->get('expendable.login_uri')); |
||
| 45 | } |
||
| 46 | } |
||
| 47 | |||
| 48 | return $next($request); |
||
| 49 | } |
||
| 50 | } |