From c68bc8928870029800a836327bf284af24bfa186 Mon Sep 17 00:00:00 2001 From: Visman Date: Sat, 4 Dec 2021 18:30:08 +0700 Subject: [PATCH] Update User model --- app/Models/User/User.php | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/app/Models/User/User.php b/app/Models/User/User.php index 7e8bcf91..60a9bdb2 100644 --- a/app/Models/User/User.php +++ b/app/Models/User/User.php @@ -47,7 +47,7 @@ class User extends DataModel */ protected function getisUnverified(): bool { - return $this->group_id === FORK_GROUP_UNVERIFIED; + return FORK_GROUP_UNVERIFIED === $this->group_id; } /** @@ -55,9 +55,9 @@ class User extends DataModel */ protected function getisGuest(): bool { - return $this->group_id === FORK_GROUP_GUEST - || $this->id < 2 + return FORK_GROUP_GUEST === $this->group_id || null === $this->group_id; + || $this->id < 1 } /** @@ -65,7 +65,7 @@ class User extends DataModel */ protected function getisAdmin(): bool { - return $this->group_id === FORK_GROUP_ADMIN; + return FORK_GROUP_ADMIN === $this->group_id; } /** @@ -73,8 +73,7 @@ class User extends DataModel */ protected function getisAdmMod(): bool { - return $this->group_id === FORK_GROUP_ADMIN - || 1 == $this->g_moderator; + return $this->isAdmin || 1 == $this->g_moderator; } /** @@ -91,7 +90,7 @@ class User extends DataModel */ public function isModerator(Model $model): bool { - if (1 != $this->g_moderator) { + if (1 !== $this->g_moderator) { return false; }