A client-owned service.

A Service is an instance of a Product purchased by a Client by way of an Order and, optionally, provisioned to a Server by a provisioning module.

Services are attached to a Domain name. The status of the attached domain name is tracked here.

The payment gateway used, the recurring amount and billing cycle, as well as the initial payment used to activate this product are recorded here.

If the provisioning module provides instrumentation for tracking bandwidth and disk space usage, it is tracked and stored in this object.

If the Service requires a username and password to utilize, those are tracked here.

If this Service is suspended, the reason for the suspension is stored here. Instanced Services can also be made immune to automatic suspension by WHMCS, for a specific time period or until suspensions are intentionally re-allowed. This can allow the operator to cause a Service to remain active despite WHMCS's billing rules. (For example, the operator may flag the operator's own websites as immune from suspension, while utilizing all the other management features of WHMCS).

Dedicated IP addresses and the nameservers for the Domain attached to this Service are stored in this object.

This Service can act as a parent to various Service\Addons, which provide additional features beyond the configuration of the Product this Service was instanced from.

Any CancellationRequests for this server can also be accessed via this object.

class Service extends AbstractModel

Constants

STATUS_PENDING

STATUS_ACTIVE

STATUS_SUSPENDED

Properties summary

Type Property Description
protected $table
protected $columnMap
protected $dates
protected $booleans
protected $appends
protected $hidden
int $id Unique ID for this service.
int $clientId ID of client who owns this service.
int $orderId ID of order used to purchase this service.
int $packageId ID of package purchased in the order for this service.
int $serverId ID of server this service has been provisioned to.
Carbon $registrationDate Date this service was purchased.
string $domain Domain name this service is registered under.
string $paymentGateway English language internal name for the gateway used to originally purchase this service.
float $firstPaymentAmount The first amount paid for this service.
float $recurringAmount The recurring payment amount for this service.
string $billingCycle English language internal name of this service's billing cycle from this set: 'Free Account', 'One Time', 'Monthly', 'Quarterly', 'Semi-Annually', 'Annually', 'Biennially', 'Triennially'
string $nextDueDate Date next payment is due.
string $nextInvoiceDate Date next invoice will be generated.
string $terminationDate Date the service was Terminated or Cancelled.
string $completedDate Date the service was Completed.
string $domainStatus English language internal name of status of this service, from this set: 'Pending', 'Active', 'Suspended', 'Terminated', 'Cancelled', 'Fraud' (Additionally custom status may exist)
string $username Username associated with this service (for external control panels, etc)
string $password Password associated with this service.
string $notes Admin custom notes, with expectation that client will not see them.
string $subscriptionId If the service is a recurring service, and a payment gateway which supports subscriptions have been used (such as PayPal), the subscription ID for the payment gateway is stored here.
int $promotionId ID of promotion used when purchasing this service, or null otherwise.
string $suspendReason An admin provided string as to why a suspension was enacted on this service.
bool $overrideAutoSuspend If true, WHMCS will not attempt to automatically suspend this service.
Carbon $overrideSuspendUntilDate If Auto Suspend is not overridden, on this date the service will be automatically suspended.
string $dedicatedIp If the service provides a dedicated IP address, it is stored here.
string $assignedIps If the service is assigned to IP addresses, those addresses will appear as comma delimited strings here.
string $ns1 If the service requires a nameserver (such as a domain name), the first nameserver is stored here.
string $ns2 If the service requires a second nameserver, that nameserver is stored here.
int $diskUsage If the service's module provides disk usage telemetry, that value is stored here.
int $diskLimit If the service was purchased with a disk usage limit, that limit is stored here.
int $bandwidthUsage If the service's module provides bandwidth usage telemetry, that value is stored here.
int $bandwidthLimit If the service was purchased with a disk usage limit, that limit is stored here.
Carbon $lastUpdateDate Date this service was last modified.
Carbon $createdAt Date this service was created.
Carbon $updatedAt Date this service was last modified.
Properties $serviceProperties
Client $client Client object which owns this service.
Product $product Product associated with this service.
Collection|Addon[] $addons Addons purchased alongside this service.
Collection|CancellationRequest[] $cancellationRequests Any cancellation requests related to this service.
Collection|Queue[] $failedActions Any failed actions related to this service.
Collection|CustomFieldValue[] $customFieldValues
Order $order
Server $serverModel

Methods summary

Return Type Method Name Description
Builder scopeUserId(Builder $query, int $userId) -
Builder scopeActive(Builder $query) -
Builder scopeMarketConnect(Builder $query) Filter for only MarketConnect services.
Builder scopeIsConsideredActive(Builder $query) -
Builder scopeIsNotRecurring(Builder $query) -
BelongsTo client() Each service belongs to one client.
BelongsTo product() Each service is an instance of a product.
HasMany addons() Each service can have many addons
BelongsTo order() A domain belongs to a single order.
HasMany cancellationRequests() Each service can have many cancellation requests
HasMany ssl() Each service could have many ssl records.
bool hasAvailableUpgrades() Determine if a service has available upgrades.
HasMany failedActions() -
HasMany|CustomFieldValue customFieldValues() -
getCustomFieldType() -
getCustomFieldRelId() -
Properties getServicePropertiesAttribute() -
bool canBeUpgraded() Determine if service can be upgraded.
bool isService() Is this entity a service?
bool isAddon() Is this entity an addon?
HasOne serverModel() -

Details

Builder scopeUserId (Builder $query, int $userId)

Parameters

Builder $query
int $userId

Return Value

Builder

Builder scopeActive (Builder $query)

Parameters

Builder $query

Return Value

Builder

Builder scopeMarketConnect (Builder $query)

Filter for only MarketConnect services.

Parameters

Builder $query

Return Value

Builder

Builder scopeIsConsideredActive (Builder $query)

Parameters

Builder $query

Return Value

Builder

Builder scopeIsNotRecurring (Builder $query)

Parameters

Builder $query

Return Value

Builder

BelongsTo client ()

Each service belongs to one client.

Return Value

BelongsTo

BelongsTo product ()

Each service is an instance of a product.

Return Value

BelongsTo

HasMany addons ()

Each service can have many addons

Return Value

HasMany

BelongsTo order ()

A domain belongs to a single order.

Return Value

BelongsTo

HasMany cancellationRequests ()

Each service can have many cancellation requests

Return Value

HasMany

HasMany ssl ()

Each service could have many ssl records.

Return Value

HasMany

bool hasAvailableUpgrades ()

Determine if a service has available upgrades.

Return Value

bool

HasMany failedActions ()

Return Value

HasMany

HasMany|CustomFieldValue customFieldValues ()

Return Value

HasMany|CustomFieldValue

protected getCustomFieldType ()

protected getCustomFieldRelId ()

Properties getServicePropertiesAttribute ()

Return Value

Properties

bool canBeUpgraded ()

Determine if service can be upgraded.

Return Value

bool

bool isService ()

Is this entity a service?

Return Value

bool

bool isAddon ()

Is this entity an addon?

Return Value

bool

HasOne serverModel ()

Return Value

HasOne