Conditions | 4 |
Paths | 3 |
Total Lines | 11 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php namespace jlourenco\base\Middleware; |
||
16 | public function handle($request, Closure $next) |
||
17 | { |
||
18 | if (!Sentinel::check() || !Sentinel::inRole('admin')) { |
||
19 | if ($request->ajax()) { |
||
20 | return response('Unauthorized.', 401); |
||
21 | } else { |
||
22 | return Redirect::route('login'); |
||
23 | } |
||
24 | } |
||
25 | return $next($request); |
||
26 | } |
||
27 | } |
||
28 |