1
0
Fork 0

app/Models/User.php: adding getRoleAttribute()

This commit is contained in:
Henrik Hautakoski 2021-07-13 18:01:49 +02:00
parent d25a0aa94f
commit 52daa3b68f

View file

@ -46,4 +46,12 @@ class User extends Authenticatable
{
return $this->hasMany(Character::class);
}
public function getRoleAttribute()
{
if (!$this->attributes['role']) {
return 'user';
}
return $this->attributes['role'];
}
}