class Client extends AbstractUser implements ContactInterface, UserInterface

Traits

EmailPreferences
User

Constants

STATUS_ACTIVE

STATUS_INACTIVE

STATUS_CLOSED

PAYMENT_DATA_MIGRATED

Properties summary

Type Property Description
protected $table
protected $columnMap
$timestamps
protected $dates
protected $booleans
protected $casts
$unique
protected $appends
protected $fillable
protected $hidden

Methods summary

Return Type Method Name Description
users() -
usersRelation() -
getUserIds() -
User|null owner() Get owner.
HasMany invites() A client can have many invites.
HasMany|Domain domains() A client can have many domains.
HasMany|Service services() A client can have many services.
HasMany|Addon addons() A client can have many add-on services.
HasMany contacts() A client can have many contacts.
HasOne billingContact() -
HasMany quotes() A client can have many quotes for services.
HasOne affiliate() A client can have an associated affiliate record.
HasMany invoices() A client can have many invoices.
HasMany transactions() A client can have many transactions.
HasMany remoteAccountLinks() A client can have many linked remote accounts.
HasMany orders() A client can have many orders.
HasMany|Consent marketingConsent() -
HasOne currencyrel() A client has an associated currency.
Builder scopeEmail($query, $email) Filter by email.
bool isOwnedBy(User $user) Is client owned by a given user?
Stdclass getAutheduserAttribute() deprecated For backwards compat with six theme in v8.0.0
runPostLoginEvents() Executes post login of a client.
static string[] getStatuses() Get client status values.
bool hasDomain(string $domainName) Determines if client has a given domain name.
string generateCreditCardEncryptionKey() Generate the AES key used to encrypt a user's credit card information.
Collection|Alert[] getAlerts(AlertFactory $factory = null) Retrieve a client's alerts.
array|false isCreditCardExpiring(int $withinMonths = 2) Determine if a user's credit card is going to expire within a number of months.
string getPhoneNumberFormattedAttribute() Returns formatted phone number.
getDisplayNameAttribute() -
string getCountryNameAttribute() Returns the human readable name for the clients country.
string generateCreditCardEncryptedField(string $value) Generate an AES Encrypted string from the passed value.
getUsernameAttribute() -
bool hasSingleSignOnPermission() Returns if the client has Single Sign-On Enabled for their account.
bool isAllowedToAuthenticate() Should the user be allowed to authenticate
bool isEmailAddressVerified() Returns if the clients' owners email address is verified.
updateLastLogin(Carbon $time = null, $ip = null, $host = null) -
HasMany|CustomFieldValue customFieldValues() -
getCustomFieldType() -
getCustomFieldRelId() -
bool hasPermission(string|int $permission) This fulfills the UserInterface
HasMany tickets() A client can have many tickets.
bool isOptedInToMarketingEmails() Determine if user is opted in to marketing emails.
Client marketingEmailOptIn(string $userIp = '', bool $performCurrentSettingCheck = true) Opt in to email marketing.
Client marketingEmailOptOut(string $userIp = '', bool $performCurrentSettingCheck = true) Opt out of email marketing.
Client logActivity(string $message) Log activity.
bool|null deleteEntireClient() Deletes a client and all associated data.
static  getGroups() -
needsCardDetailsMigrated() -
needsBankDetailsMigrated() -
needsUnknownPaymentTokenMigrated() -
needsAnyPaymentDetailsMigrated() -
migratePaymentDetailsIfRequired($forceInCron = false) -
markCardDetailsAsMigrated() -
markBankDetailsAsMigrated() -
markPaymentTokenMigrated() -
HasMany payMethods() -
HasOne|BelongsTo defaultBillingContact() Return a model of the billing contact or the client itself
string getGroupNameAttribute() -
HasMany domainSslStatuses() -
generateUniquePlaceholderEmail() -
deleteAllCreditCards() -
static array getUsedCardTypes() Get the card types currently used.
array buildBillingContactsArray() -
PayMethodInterface createRemoteCardPayMethod(string|Gateway $gateway, string $cardNumber, string $cardExpiryDate, string $remoteToken, string|integer $billingContactId = 'billing', string $description = '', null|string $cardType = null, null|string $cardStartDate = null, null|string $cardIssueNumber = null) -
PayMethodInterface createCardPayMethod(string $cardNumber, string $cardExpiryDate, string|integer $billingContactId = 'billing', string $description = '', null|string $cardType = null, null|string $cardStartDate = null, null|string $cardIssueNumber = null) -
PayMethodInterface createBankPayMethod(string $accountType, string $routingNumber, string $accountNumber, string $bankName, string $accountHolderName, string|integer $billingContactId = 'billing', string $description = '') -
PayMethodInterface createRemoteBankPayMethod(string|Gateway $gateway, string $remoteToken, string $accountNumber = '', string $accountHolderName = '', string|integer $billingContactId = 'billing', string $description = '') -
float getClientDiscountPercentage() Get client discount percentage.
Client addCredit(string $description, float $amount) Add a credit + credit log entry.
getLink() -
authedUserIsOwner() -
getAuthUserById($userId) -
string getCurrencyCodeAttribute() -
Client mergeTo(Client $client) -

Details

users ()

usersRelation ()

getUserIds ()

User|null owner ()

Get owner.

Return Value

User|null

HasMany invites ()

A client can have many invites.

Return Value

HasMany

HasMany|Domain domains ()

A client can have many domains.

Return Value

HasMany|Domain

HasMany|Service services ()

A client can have many services.

Return Value

HasMany|Service

HasMany|Addon addons ()

A client can have many add-on services.

Return Value

HasMany|Addon

HasMany contacts ()

A client can have many contacts.

Return Value

HasMany

HasOne billingContact ()

Return Value

HasOne

HasMany quotes ()

A client can have many quotes for services.

Return Value

HasMany

HasOne affiliate ()

A client can have an associated affiliate record.

Return Value

HasOne

HasMany invoices ()

A client can have many invoices.

Return Value

HasMany

HasMany transactions ()

A client can have many transactions.

Return Value

HasMany

A client can have many linked remote accounts.

NB: this will not return remote auth links of contacts associated with the client.

Return Value

HasMany

HasMany orders ()

A client can have many orders.

Return Value

HasMany

HasMany|Consent marketingConsent ()

Return Value

HasMany|Consent

HasOne currencyrel ()

A client has an associated currency.

Named currencyrel because the name currency conflicts with field name.

Return Value

HasOne

Builder scopeEmail ($query, $email)

Filter by email.

Parameters

$query
$email

Return Value

Builder

bool isOwnedBy (User $user)

Is client owned by a given user?

Parameters

User $user

Return Value

bool

Stdclass getAutheduserAttribute () deprecated

deprecated Since 8.0.1

For backwards compat with six theme in v8.0.0

Return Value

Stdclass

runPostLoginEvents ()

Executes post login of a client.

static string[] getStatuses ()

Get client status values.

Return Value

string[]

bool hasDomain (string $domainName)

Determines if client has a given domain name.

Checks for both domains associated to services as well as domain registrations.

Parameters

string $domainName

Return Value

bool

protected string generateCreditCardEncryptionKey ()

Generate the AES key used to encrypt a user's credit card information.

Return Value

string

Collection|Alert[] getAlerts (AlertFactory $factory = null)

Retrieve a client's alerts.

Parameters

AlertFactory $factory

Return Value

Collection|Alert[]

array|false isCreditCardExpiring (int $withinMonths = 2)

Determine if a user's credit card is going to expire within a number of months.

Parameters

int $withinMonths

Return Value

array|false An array with expiring credit card information

string getPhoneNumberFormattedAttribute ()

Returns formatted phone number.

If PhoneNumberDropdown setting enabled, then phone number will be formatted to be digestable by jackocnr/intl-tel-input script used.

Return Value

string

getDisplayNameAttribute ()

string getCountryNameAttribute ()

Returns the human readable name for the clients country.

Return Value

string

string generateCreditCardEncryptedField (string $value)

Generate an AES Encrypted string from the passed value.

Parameters

string $value

Return Value

string

getUsernameAttribute ()

bool hasSingleSignOnPermission ()

Returns if the client has Single Sign-On Enabled for their account.

Return Value

bool

bool isAllowedToAuthenticate ()

Should the user be allowed to authenticate

Return Value

bool

bool isEmailAddressVerified ()

Returns if the clients' owners email address is verified.

Return Value

bool

updateLastLogin (Carbon $time = null, $ip = null, $host = null)

Parameters

Carbon $time
$ip
$host

HasMany|CustomFieldValue customFieldValues ()

Return Value

HasMany|CustomFieldValue

protected getCustomFieldType ()

protected getCustomFieldRelId ()

bool hasPermission (string|int $permission)

This fulfills the UserInterface

Parameters

string|int $permission

Return Value

bool

HasMany tickets ()

A client can have many tickets.

Return Value

HasMany

bool isOptedInToMarketingEmails ()

Determine if user is opted in to marketing emails.

Return Value

bool

Client marketingEmailOptIn (string $userIp = '', bool $performCurrentSettingCheck = true)

Opt in to email marketing.

Parameters

string $userIp
bool $performCurrentSettingCheck

Return Value

Client

Exceptions

AlreadyOptedIn

Client marketingEmailOptOut (string $userIp = '', bool $performCurrentSettingCheck = true)

Opt out of email marketing.

Parameters

string $userIp
bool $performCurrentSettingCheck

Return Value

Client

Exceptions

AlreadyOptedOut

Client logActivity (string $message)

Log activity.

Parameters

string $message

Return Value

Client

bool|null deleteEntireClient ()

Deletes a client and all associated data.

Return Value

bool|null

Exceptions

Exception
Fatal

static getGroups ()

needsCardDetailsMigrated ()

needsBankDetailsMigrated ()

needsUnknownPaymentTokenMigrated ()

needsAnyPaymentDetailsMigrated ()

migratePaymentDetailsIfRequired ($forceInCron = false)

Parameters

$forceInCron

markCardDetailsAsMigrated ()

markBankDetailsAsMigrated ()

markPaymentTokenMigrated ()

HasMany payMethods ()

Return Value

HasMany

HasOne|BelongsTo defaultBillingContact ()

Return a model of the billing contact or the client itself

This is determined by a value set against billingcid.

Return Value

HasOne|BelongsTo

string getGroupNameAttribute ()

Return Value

string

HasMany domainSslStatuses ()

Return Value

HasMany

generateUniquePlaceholderEmail ()

deleteAllCreditCards ()

static array getUsedCardTypes ()

Get the card types currently used.

Return Value

array

array buildBillingContactsArray ()

Return Value

array

PayMethodInterface createRemoteCardPayMethod (string|Gateway $gateway, string $cardNumber, string $cardExpiryDate, string $remoteToken, string|integer $billingContactId = 'billing', string $description = '', null|string $cardType = null, null|string $cardStartDate = null, null|string $cardIssueNumber = null)

Parameters

string|Gateway $gateway The gateway to store the Pay Method against
string $cardNumber The card number (or last 4 digits). Full card number will not be stored.
string $cardExpiryDate Card expiry date in mmyy format.
string $remoteToken The remote token for the pay method.
string|integer $billingContactId The id of the billing contact to use.
string $description The description for the new pay method.
null|string $cardType The card type to use. Null will attempt to get card type from card number.
null|string $cardStartDate Optional. Card start date in mmyy format.
null|string $cardIssueNumber Optional. The issue number for the card.

Return Value

PayMethodInterface

Exceptions

Exception For missing required values or invalid/inactive Gateway.

PayMethodInterface createCardPayMethod (string $cardNumber, string $cardExpiryDate, string|integer $billingContactId = 'billing', string $description = '', null|string $cardType = null, null|string $cardStartDate = null, null|string $cardIssueNumber = null)

Parameters

string $cardNumber The card number (or last 4 digits). Full card number will not be stored.
string $cardExpiryDate Card expiry date in mmyy format.
string|integer $billingContactId The id of the billing contact to use.
string $description The description for the new pay method.
null|string $cardType The card type to use. Null will attempt to get card type from card number.
null|string $cardStartDate Optional. Card start date in mmyy format.
null|string $cardIssueNumber Optional. The issue number for the card.

Return Value

PayMethodInterface

Exceptions

Exception For missing required values.

PayMethodInterface createBankPayMethod (string $accountType, string $routingNumber, string $accountNumber, string $bankName, string $accountHolderName, string|integer $billingContactId = 'billing', string $description = '')

Parameters

string $accountType A type, such as checking or savings
string $routingNumber Bank routing number
string $accountNumber Bank account number
string $bankName Name of bank the account belongs to
string $accountHolderName Name of the account holder
string|integer $billingContactId The id of the billing contact to use.
string $description The description for the new pay method.

Return Value

PayMethodInterface

Exceptions

Exception For missing required values.

PayMethodInterface createRemoteBankPayMethod (string|Gateway $gateway, string $remoteToken, string $accountNumber = '', string $accountHolderName = '', string|integer $billingContactId = 'billing', string $description = '')

Parameters

string|Gateway $gateway The gateway to store the Pay Method against
string $remoteToken The remote token for a remote bank account.
string $accountNumber Bank account number
string $accountHolderName Name of the account holder
string|integer $billingContactId The id of the billing contact to use.
string $description The description for the new pay method.

Return Value

PayMethodInterface

Exceptions

Exception For missing required values or invalid/inactive Gateway.

float getClientDiscountPercentage ()

Get client discount percentage.

Return Value

float

Client addCredit (string $description, float $amount)

Add a credit + credit log entry.

Parameters

string $description
float $amount

Return Value

Client

authedUserIsOwner ()

getAuthUserById ($userId)

Parameters

$userId

string getCurrencyCodeAttribute ()

Return Value

string

Client mergeTo (Client $client)

Parameters

Client $client

Return Value

Client