# 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

```php
public function scopeOfClient(Builder $query, $clientId)
```

Retrieve domains for a specific user

**Parameters**

| Type | Name | Description |
|  --- | --- | --- |
| `Builder` | `$query` |  |
| `integer` | `$clientId` |  |


**Returns** `Builder`

### scopeNextDueBefore

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

Retrieve domains due before a given date.

**Parameters**

| Type | Name | Description |
|  --- | --- | --- |
| `\Illuminate\Database\Eloquent\Builder` | `$query` |  |
| `Carbon` | `$date` |  |


**Returns** `\Illuminate\Database\Eloquent\Builder`

### scopeIsConsideredActive

```php
public function scopeIsConsideredActive(Builder $query)
```

**Parameters**

| Type | Name | Description |
|  --- | --- | --- |
| `Builder` | `$query` |  |


**Returns** `Builder`

### scopeFree

```php
public function scopeFree(Builder $query)
```

Ensure the recurring amount is 0.00.

**Parameters**

| Type | Name | Description |
|  --- | --- | --- |
| `Builder` | `$query` |  |


**Returns** `Builder`

### scopeNotFree

```php
public function scopeNotFree(Builder $query)
```

Ensure the recurring amount is not 0.00.

**Parameters**

| Type | Name | Description |
|  --- | --- | --- |
| `Builder` | `$query` |  |


**Returns** `Builder`

### getTldAttribute

```php
public function getTldAttribute()
```

Get domain tld extension.

**Returns** `string`

### getNonTerminalStatuses

```php
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

```php
public function client()
```

Each domain belongs to one client.

**Returns** `\Illuminate\Database\Eloquent\Relations\BelongsTo`

### additionalFields

```php
public function additionalFields()
```

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

**Returns** `\Illuminate\Database\Eloquent\Relations\HasMany`

### extra

```php
public function extra()
```

Every domain may have extra information fields

**Returns** `HasMany`

### order

```php
public function order()
```

A domain belongs to a single order.

**Returns** `BelongsTo`

### paymentGateway

```php
public function paymentGateway()
```

Each domain has many payment gateway records.

**Returns** `\Illuminate\Database\Eloquent\Relations\HasMany`

### invoiceItems

```php
public function invoiceItems()
```

A domain can have many invoice items

**Returns** `hasMany`

### invoices

```php
public function invoices(): BelongsToMany
```

### getRegistrarInterface

```php
public function getRegistrarInterface()
```

Get domain registrar module interface.

**Returns** `\WHMCS\Module\Registrar`

### getDomainObject

```php
public function getDomainObject()
```

Get domain object.

**Returns** `\WHMCS\Domains\Domain`

### setRemindersAttribute

```php
public function setRemindersAttribute(string $reminderString)
```

Enforce business logic around domain reminders.

**Parameters**

| Type | Name | Description |
|  --- | --- | --- |
| `string` | `$reminders` |  |


### failedActions

```php
public function failedActions()
```

**Returns** `HasMany`

### isConfiguredTld

```php
public function isConfiguredTld()
```

Returns true if tld is configured for sale.

**Returns** `bool`

### getAdditionalFields

```php
public function getAdditionalFields()
```

Get additional fields for the current domain.

**Returns** `AdditionalFields`

### getExtensionAttribute

```php
public function getExtensionAttribute()
```

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

### getGracePeriodAttribute

```php
public function getGracePeriodAttribute()
```

**Returns** `int`

### getGracePeriodFeeAttribute

```php
public function getGracePeriodFeeAttribute()
```

**Returns** `float`

### getRedemptionGracePeriodAttribute

```php
public function getRedemptionGracePeriodAttribute()
```

**Returns** `int`

### getRedemptionGracePeriodFeeAttribute

```php
public function getRedemptionGracePeriodFeeAttribute()
```

**Returns** `float`

### getLink

```php
public function getLink()
```

### getBestNameserversForNewOrder

```php
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

```php
public function getTranslatedStatusAttribute(): ?string
```

Get the translated domain status

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

### scopeDueForSync

```php
public function scopeDueForSync(Builder $query)
```

Retrieve domain names due for Domain Synchronisation

**Parameters**

| Type | Name | Description |
|  --- | --- | --- |
| `Builder` | `$query` |  |


**Returns** `Builder`

### isFree

```php
public function isFree(): bool
```

**Returns** `bool`

### recalculateRecurringPrice

```php
public function recalculateRecurringPrice(): self
```

### getRegistrarModuleDisplayName

```php
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**

| Type | Name | Description |
|  --- | --- | --- |
| `string` | `$stringForNone` | The string to return if the no Registrar Module has been specified. |


**Returns** `string`

### getInvoicingServiceItemType

```php
public function getInvoicingServiceItemType(): string
```

### getInvoicingServiceFirstPaymentAmount

```php
public function getInvoicingServiceFirstPaymentAmount(): Price
```

### getInvoicingServiceRecurringAmount

```php
public function getInvoicingServiceRecurringAmount(): Price
```