Skip to content
Last updated

WHMCS\Domain\Domain

Class · extends AbstractModel · implements InvoicingServiceInterface, SubscriptionAwareInterface

A customer's domain.

Customers are allowed to register and transfer domain names using WHMCS. These domain names are then associated with their Client record and any Services they purchased with the Domain name.

Note that the "subscriptionid" field was originally intended to store the PayPal Subscription ID for a domain when one was first created, and then used to track and associate future payments of that subscription ID. However, later the logic was changed and so now PayPal subscription matching is done based only invoice or service relationships. Nonetheless, this field is still exposed via the admin interface and can be set and used manually by admin users.

Traits

  • DomainTraits
  • SubscriptionAwareTrait

Methods

scopeOfClient

public function scopeOfClient(Builder $query, $clientId)

Retrieve domains for a specific user

Parameters

TypeNameDescription
Builder$query
integer$clientId

Returns Builder

scopeNextDueBefore

public function scopeNextDueBefore(Builder $query, Carbon $date)

Retrieve domains due before a given date.

Parameters

TypeNameDescription
\Illuminate\Database\Eloquent\Builder$query
Carbon$date

Returns \Illuminate\Database\Eloquent\Builder

scopeIsConsideredActive

public function scopeIsConsideredActive(Builder $query)

Parameters

TypeNameDescription
Builder$query

Returns Builder

scopeFree

public function scopeFree(Builder $query)

Ensure the recurring amount is 0.00.

Parameters

TypeNameDescription
Builder$query

Returns Builder

scopeNotFree

public function scopeNotFree(Builder $query)

Ensure the recurring amount is not 0.00.

Parameters

TypeNameDescription
Builder$query

Returns Builder

getTldAttribute

public function getTldAttribute()

Get domain tld extension.

Returns string

getNonTerminalStatuses

public static function getNonTerminalStatuses(): array

Status values representative of an entry that has further status values it could transition to.

Returns string[] — Array of Statuses as strings

client

public function client()

Each domain belongs to one client.

Returns \Illuminate\Database\Eloquent\Relations\BelongsTo

additionalFields

public function additionalFields()

Every domain can have one or more additional registrar-specific fields.

Returns \Illuminate\Database\Eloquent\Relations\HasMany

extra

public function extra()

Every domain may have extra information fields

Returns HasMany

order

public function order()

A domain belongs to a single order.

Returns BelongsTo

paymentGateway

public function paymentGateway()

Each domain has many payment gateway records.

Returns \Illuminate\Database\Eloquent\Relations\HasMany

invoiceItems

public function invoiceItems()

A domain can have many invoice items

Returns hasMany

invoices

public function invoices(): BelongsToMany

getRegistrarInterface

public function getRegistrarInterface()

Get domain registrar module interface.

Returns \WHMCS\Module\Registrar

getDomainObject

public function getDomainObject()

Get domain object.

Returns \WHMCS\Domains\Domain

setRemindersAttribute

public function setRemindersAttribute(string $reminderString)

Enforce business logic around domain reminders.

Parameters

TypeNameDescription
string$reminders

failedActions

public function failedActions()

Returns HasMany

isConfiguredTld

public function isConfiguredTld()

Returns true if tld is configured for sale.

Returns bool

getAdditionalFields

public function getAdditionalFields()

Get additional fields for the current domain.

Returns AdditionalFields

getExtensionAttribute

public function getExtensionAttribute()

Returns \Illuminate\Database\Eloquent\Model\|null\|static\|Extension

getGracePeriodAttribute

public function getGracePeriodAttribute()

Returns int

getGracePeriodFeeAttribute

public function getGracePeriodFeeAttribute()

Returns float

getRedemptionGracePeriodAttribute

public function getRedemptionGracePeriodAttribute()

Returns int

getRedemptionGracePeriodFeeAttribute

public function getRedemptionGracePeriodFeeAttribute()

Returns float

public function getLink()

getBestNameserversForNewOrder

public function getBestNameserversForNewOrder()

Get best nameservers for new domain order.

Uses the following, in order:

  • Matching service domain record
  • Nameservers specified in order
  • System default values

Returns string[]

getTranslatedStatusAttribute

public function getTranslatedStatusAttribute(): ?string

Get the translated domain status

Returns string — Returns translated domain status or internal status if translation is not available

scopeDueForSync

public function scopeDueForSync(Builder $query)

Retrieve domain names due for Domain Synchronisation

Parameters

TypeNameDescription
Builder$query

Returns Builder

isFree

public function isFree(): bool

Returns bool

recalculateRecurringPrice

public function recalculateRecurringPrice(): self

getRegistrarModuleDisplayName

public function getRegistrarModuleDisplayName(string $stringForNone): string

Retrieve the display name of the Registrar Module associated with this Domain.

> In the instance of no module being set, the $stringForNone default value will be returned. > In the instance of a missing module, no Display name can be retrieved. The module > as specified in the database will be returned as-is.

Parameters

TypeNameDescription
string$stringForNoneThe string to return if the no Registrar Module has been specified.

Returns string

getInvoicingServiceItemType

public function getInvoicingServiceItemType(): string

getInvoicingServiceFirstPaymentAmount

public function getInvoicingServiceFirstPaymentAmount(): Price

getInvoicingServiceRecurringAmount

public function getInvoicingServiceRecurringAmount(): Price