Class · extends AbstractModel · implements ServiceInterface, InvoicingServiceInterface, SubscriptionAwareInterface, ServicePricingInterface
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.
DomainTraitsProvisioningTraitsSubscriptionAwareTrait
| Name | Description |
|---|---|
STATUS_PENDING | |
STATUS_ACTIVE | |
STATUS_SUSPENDED | |
STATUS_CANCELLED |
public static function boot()public function getServiceActual(): selfpublic function getServiceSurrogate(): selfpublic function hasServiceSurrogate(): boolpublic function getServiceClient(): Clientpublic function getServiceProperties(): Propertiespublic function scopeUserId(Builder $query, int $userId): BuilderParameters
| Type | Name | Description |
|---|---|---|
Builder | $query | |
int | $userId |
Returns Builder
public function scopeDomain(Builder $query, string $domain): BuilderParameters
| Type | Name | Description |
|---|---|---|
Builder | $query | |
string | $domain |
Returns Builder
public function scopeActive(Builder $query): BuilderParameters
| Type | Name | Description |
|---|---|---|
Builder | $query |
Returns Builder
public function scopeMarketConnect(Builder $query): BuilderFilter for only MarketConnect services.
Parameters
| Type | Name | Description |
|---|---|---|
Builder | $query |
Returns Builder
public function scopeIsConsideredActive(Builder $query): BuilderParameters
| Type | Name | Description |
|---|---|---|
Builder | $query |
Returns Builder
public function scopeIsNotRecurring(Builder $query): BuilderParameters
| Type | Name | Description |
|---|---|---|
Builder | $query |
Returns Builder
public function isRecurring(): boolReturns bool
public function client()Each service belongs to one client.
Returns \Illuminate\Database\Eloquent\Relations\BelongsTo
public function product()Each service is an instance of a product.
Returns \Illuminate\Database\Eloquent\Relations\BelongsTo
public function paymentGateway()Each service has many payment gateway records.
Returns \Illuminate\Database\Eloquent\Relations\HasMany
public function addons()Each service can have many addons
Returns \Illuminate\Database\Eloquent\Relations\HasMany
public function order()A domain belongs to a single order.
Returns BelongsTo
public function promotion()Each service can have one promotion.
Returns \Illuminate\Database\Eloquent\Relations\HasOne
public function cancellationRequests()Each service can have many cancellation requests
Returns \Illuminate\Database\Eloquent\Relations\HasMany
public function ssl()Each service could have many ssl records.
Returns \Illuminate\Database\Eloquent\Relations\HasMany
public function invoices(): BelongsToManypublic function hasAvailableUpgrades()Determine if a service has available upgrades.
Returns bool
public function failedActions()Returns HasMany
public function customFieldValues()Returns HasMany\|CustomFieldValue
public function configOptions(): HasManypublic function getServicePropertiesAttribute()Returns Properties
public static function getNonTerminalStatuses(): arrayStatus values representative of an entry that has further status values it could transition to.
Returns string[] — Array of Statuses as strings
public function canBeUpgraded()Determine if service can be upgraded.
Returns bool
public function shouldShowUpgradeLink(): boolpublic function hasOutstandingInvoices(): boolpublic function isService()Is this entity a service?
Returns bool
public function isAddon()Is this entity an addon?
Returns bool
public function serverModel()Each service may belong to a server.
Returns \Illuminate\Database\Eloquent\Relations\belongsTo
public function legacyProvision()Run provision action in legacy mode.
Legacy mode returns 'success' on success and an error message string on failure.
Returns string
public function getMetricProvider()Returns ProviderInterface\|null
public function metrics($onlyBilledMetrics = false, $mode = null)Returns ServiceMetric[]
public function getLink()public function getUniqueIdentifierValue($uniqueIdField)Parameters
| Type | Name | Description |
|---|---|---|
string | $uniqueIdField |
Returns mixed\|string\|null
public function getHexColorFromStatus(): stringpublic function getParentalSiblingAttribute(): ?selfLocate another Service that appears to be related to this service in a parental relationship. This is despite $this Service not being an Addon to another Service. Thus a result from this method implies $this Service is a pseudo-addon. Eg. SSL service ordered independently, but with the same domain as a hosting Service; return the hosting Service as a "parent".
Returns self\|null
public function getProvisioningModuleName(): stringpublic function getCustomActionData(): arrayReturns array
public function getFirstPaymentAmount(): Pricepublic function getRecurringAmount(): Pricepublic function getBillingCycle(): stringpublic function getPaymentGateway(): Gatewaypublic function getNextDueDate(): ?Carbonpublic function getPromotions(): SupportCollectionCurrently we only have one promotion, but we are planning to have more than one in the future, so we should prepare for that.
Returns SupportCollection
public function getServiceProduct(): ?Productpublic function getInvoicingServiceItemType(): stringpublic function getInvoicingServiceFirstPaymentAmount(): Pricepublic function getInvoicingServiceRecurringAmount(): Pricepublic function isServiceMetricUsage(): boolpublic function data()