refactor: deprecate isStaffMember; add isVerified

This commit is contained in:
Miguel Nogueira 2022-08-19 00:52:46 +01:00
parent e6f02ce07f
commit e691e61bb5
No known key found for this signature in database
GPG Key ID: 3C6A7E29AF26D370

View File

@ -103,16 +103,37 @@ class User extends Authenticatable implements MustVerifyEmail
// UTILITY LOGIC
public function isStaffMember()
public function isVerified(): bool {
return !is_null($this->email_verified_at);
}
/**
* Checks if user is staff
*
* @deprecated This method is being replaced by a better way of checking permissions, rather than checking for group name.
* @return bool
*/
public function isStaffMember(): bool
{
return $this->hasAnyRole('reviewer', 'admin', 'hiringManager');
}
public function has2FA()
/**
* Checks if user has 2fa enabled
*
* @return bool
*/
public function has2FA(): bool
{
return ! is_null($this->twofa_secret);
}
/**
* Checks if user has team
*
* @param $team
* @return bool
*/
public function hasTeam($team): bool
{
if ($team instanceof Team || is_int($team))