admin(roles): add has one on User -> AdminRole
This commit is contained in:
parent
9d005b5fd2
commit
1e61fd161c
4 changed files with 70 additions and 1 deletions
|
@ -227,6 +227,16 @@ class User extends Model implements
|
|||
return $this->root_admin ? 'Super Administrator' : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the admin role associated with a user.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasOne
|
||||
*/
|
||||
public function adminRole()
|
||||
{
|
||||
return $this->hasOne(AdminRole::class, 'id', 'admin_role_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns all servers that a user owns.
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue