adjusted RequireRole middleware to be more cohesivie

This commit is contained in:
2019-01-10 08:50:59 -06:00
parent 7b4249d94f
commit fee13804d5

View File

@@ -33,12 +33,10 @@ class RequireRole
abort(403, "You don't any roles. You don't belong here.");
}
if($ranking[$check[0]->role] >= $ranking[$role]) {
$confirmed = true;
if($ranking[$check[0]->role] < $ranking[$role]) {
abort(403, "You don't have the correct role to be in this area.");
}
abort_unless(auth()->check() && $confirmed, 403, "You don't have the correct role to be in this area.");
return $next($request);
}
}