| Conditions | 3 |
| Paths | 3 |
| Total Lines | 13 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 10 | public function handle($request, Closure $next) |
||
| 11 | { |
||
| 12 | if (!Auth::check()) { |
||
| 13 | // I included this check because you have it, but it really should be part of your 'auth' middleware, most likely added as part of a route group. |
||
| 14 | return redirect(route('admin.login')); |
||
| 15 | } |
||
| 16 | // Perform action |
||
| 17 | $user = Auth::user(); |
||
| 18 | |||
| 19 | if ($user->admin == true) { |
||
|
|
|||
| 20 | return $next($request); |
||
| 21 | } else { |
||
| 22 | abort(403); |
||
| 23 | } |
||
| 26 |