| Conditions | 4 |
| Paths | 3 |
| Total Lines | 12 |
| Code Lines | 6 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 1 | Features | 1 |
| 1 | <?php |
||
| 18 | public function handle($request, $next) |
||
| 19 | { |
||
| 20 | $user = $request->user(); |
||
| 21 | if ($user && $user->hasRole('admin')) { |
||
| 22 | return $next($request); |
||
| 23 | } |
||
| 24 | |||
| 25 | if ($request->wantsJson()) { |
||
| 26 | throw new AuthenticationException(); |
||
| 27 | } |
||
| 28 | |||
| 29 | return redirect(route('home'))->withErrors('You do not have privilege access this page'); |
||
| 30 | } |
||
| 32 |