admin(roles): add has one on User -> AdminRole

This commit is contained in:
Matthew Penner 2021-01-16 13:24:27 -07:00
parent 9d005b5fd2
commit 1e61fd161c
4 changed files with 70 additions and 1 deletions

View file

@ -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.
*