Class · extends AbstractUser · implements UserInterface
An administrative user
An administrative user is responsible for operation and maintenance of a WHMCS installation. Admins have access to create and manage clients clients, place orders, configure WHMCS, manage modules, and can access all of WHMCS's high level systems. Their accounts can log into the WHMCS client area, and like clients, can be configured to use two-factor authentication modules.
This object models an admin's record in the backend database and contains the admin's information and personal settings. phpcs:disable
AuthenticatableUserTrait
| Name | Description |
|---|---|
TEMPLATE_THEME_DEFAULT | |
MAXIMUM_PASSWORD_LENGTH |
| Type | Name | Description |
|---|---|---|
| `` | $unique |
public function getSecondFactorModuleName()public function getSecondFactorConfigName()public function getFullNameAttribute()"fullName" is the concatenation of first and last name.
In classic WHMCS objects, we compute a field named "name" which combines the first and last name for convenience in templates.
Returns string — The combined name
public function getGravatarHashAttribute()Get gravatar email address hash.
Returns string
public function getUsernameAttribute()Return the username
This method is required by the UserInterface. tbladmins has a username column, and thus a $username property, however, this model method will prevent the normal model access to that, so the method must manual fetch the value from the internal attributes property. Otherwise a NOTICE will be emitted.
Returns string
public function isAllowedToAuthenticate()Should the user be allowed to authenticate
Returns bool
public function isAllowedToMasquerade()Returns bool
public function hasPermission($permission)Has a given permission within their assigned role group
Parameters
| Type | Name | Description |
|---|---|---|
int|string | $permission | Either the permission name or the permission id |
Returns bool
public function getRoleName()Get assigned admin role group name.
Returns string
public function getRolePermissions()Array of permission names available to this admin user
Returns array
public function getModulePermissions()Returns array
public function authenticationDevices()Returns \Illuminate\Database\Eloquent\Relations\HasMany
public function getTemplateThemeNameAttribute()Returns string
public function validateUsername($username, $existingUserId = null)Validate admin username is valid.
Optionally also validate it is unique. Requires passing in of existing admin user ID or 0 for a new admin user creation.
Parameters
| Type | Name | Description |
|---|---|---|
string | $username | |
int|null | $existingUserId | Optional, pass to validate uniqueness |
public function flaggedTickets()An admin can have many flagged tickets.
Returns HasMany
public function scopeActive(Builder $query)Return only active Admin users
Parameters
| Type | Name | Description |
|---|---|---|
Builder | $query |
Returns Builder
public static function getAuthenticatedUser()Get the currently authenticated admin user.
Returns self\|null
public function getSupportDepartmentIds()Get support department ids.
Returns int[]
public function setSecondFactorConfig(array $value): selfpublic function getAuthIdentifierName()