allowed login models and update of login controller

This commit is contained in:
2019-01-09 01:41:51 -06:00
parent 39a3d7cc07
commit 5ce6f4460b

View File

@@ -55,17 +55,16 @@ class RequirePermission
'role.admin' => 4,
];
//Using eloquent let's get the roles for the character
$check = UserPermission::where('character_id', auth()->user()->character_id)->get(['permission']);
if(!isset($check[0]->role)) {
abort(403, "You don't have permissions to access this area!");
}
$checks = UserPermission::where('character_id', auth()->user()->character_id)->get(['permission']);
if($ranking[$check[0]->role] === $ranking[$role]) {
$confirmed = true;
}
if($ranking[$check[0]->role] >= $ranking[$role]) {
$confirmed = true;
foreach($check as $check) {
if(!isset($check->permission)) {
abort(403, "You don't have permission to access this area!");
}
if($ranking[$check->permission] >= $ranking[$role]) {
$confirmed = true;
}
}
return $confirmed;