app/Models/User.php: adding getRoleAttribute()
This commit is contained in:
parent
d25a0aa94f
commit
52daa3b68f
1 changed files with 8 additions and 0 deletions
|
|
@ -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'];
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue