From e691e61bb521a527fbc3055f63a43d88a4282402 Mon Sep 17 00:00:00 2001 From: miguel456 Date: Fri, 19 Aug 2022 00:52:46 +0100 Subject: [PATCH] refactor: deprecate isStaffMember; add isVerified --- app/User.php | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/app/User.php b/app/User.php index 59cc9b4..52ce4a7 100755 --- a/app/User.php +++ b/app/User.php @@ -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))