auth page udpate

This commit is contained in:
2026-04-06 22:32:58 -05:00
parent 9a0704d8f4
commit e95fe002a3

View File

@@ -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();
}
}