auth page udpate
This commit is contained in:
@@ -68,4 +68,49 @@ class User extends Authenticatable
|
||||
|
||||
return $role->role;
|
||||
}
|
||||
|
||||
public function hasRole($role) {
|
||||
//If the user is a super use then he has all roles
|
||||
if($this->hasSuperUser()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$found = UserRole::where(['character_id' => $this->character_id, 'role' => $role])->get(['role']);
|
||||
|
||||
if(isset($found[0]) && $found[0]->role == $role) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public function hasSuperUser() {
|
||||
$found = UserRole::where(['character_id' => $this->character_id])->first();
|
||||
if(isset($found[0]->role) && $found[0]->role == 'SuperUser') {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public function srpOpen() {
|
||||
return SRPShip::where([
|
||||
'character_id' => $this->character_id,
|
||||
'approved' => 'Under Review',
|
||||
])->count();
|
||||
}
|
||||
|
||||
public function srpDenied() {
|
||||
return SRPShip::where([
|
||||
'character_id' => $this->character_id,
|
||||
'approved' => 'Denied',
|
||||
])->count();
|
||||
}
|
||||
|
||||
public function srpApproved() {
|
||||
return SRPShip::where([
|
||||
'character_id' => $this->character_id,
|
||||
'approved' => 'Approved',
|
||||
])->count();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user