X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;f=app%2FModels%2FUser.php;h=db834b7a240ca423141f254a1494fc9916b82c22;hb=771f1761f0abec996838c0ccc71cec0219bad71a;hp=201361e68534eb869f94a1c3e50dc61140552a6b;hpb=8f82545b35219e093ea60e304699b61fb63966f2;p=alttp.git diff --git a/app/Models/User.php b/app/Models/User.php index 201361e..db834b7 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -40,6 +40,10 @@ class User extends Authenticatable } + public function hasGlobalRole($name) { + return !empty($this->global_roles) && in_array($name, $this->global_roles); + } + public function isAdmin() { return $this->role === 'admin'; } @@ -115,6 +119,10 @@ class User extends Authenticatable } + public function channel_crews() { + return $this->hasMany(ChannelCrew::class); + } + public function participation() { return $this->hasMany(Participant::class); } @@ -186,6 +194,7 @@ class User extends Authenticatable protected $fillable = [ 'id', 'username', + 'discord_nickname', 'discriminator', 'email', 'avatar', @@ -221,6 +230,7 @@ class User extends Authenticatable 'avatar' => 'string', 'avatar_cached' => 'datetime', 'verified' => 'boolean', + 'global_roles' => 'array', 'locale' => 'string', 'mfa_enabled' => 'boolean', 'refresh_token' => 'encrypted',