mirror of
https://github.com/sp-tarkov/forge.git
synced 2025-02-13 04:30:41 -05:00
Null Guard Admin Check
Also adds method to check if a user is a moderator.
This commit is contained in:
parent
d34a75523a
commit
5b62f359e3
@ -72,9 +72,14 @@ class User extends Authenticatable implements MustVerifyEmail
|
|||||||
return $this->belongsTo(UserRole::class, 'user_role_id');
|
return $this->belongsTo(UserRole::class, 'user_role_id');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function isMod(): bool
|
||||||
|
{
|
||||||
|
return Str::lower($this->role?->name) === 'moderator' || $this->isAdmin();
|
||||||
|
}
|
||||||
|
|
||||||
public function isAdmin(): bool
|
public function isAdmin(): bool
|
||||||
{
|
{
|
||||||
return Str::lower($this->role->name) === 'administrator';
|
return Str::lower($this->role?->name) === 'administrator';
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function casts(): array
|
protected function casts(): array
|
||||||
|
Loading…
x
Reference in New Issue
Block a user