Skip to content
Last updated

WHMCS\Service\Addon

Class · extends AbstractModel · implements ServiceInterface, InvoicingServiceInterface, SubscriptionAwareInterface, ServicePricingInterface

Service addons

Please note that "Service Addons" are completely separate from "WHMCS Addons," which add functionality to WHMCS.

A service Addon allows the operator of WHMCS to provide additional services which are conditional to the purchase of a parent Service, such as additional disk space or other similar services.

This object is an instance of a service addon, including the fees and cycles configured in the Order which purchased this addon.

Traits

  • DomainTraits
  • ProvisioningTraits
  • SubscriptionAwareTrait

Methods

getServiceActual

public function getServiceActual(): Service

getServiceSurrogate

public function getServiceSurrogate(): Service

hasServiceSurrogate

public function hasServiceSurrogate(): bool

getServiceClient

public function getServiceClient(): Client

getServiceProperties

public function getServiceProperties(): Properties

boot

public static function boot()

scopeUserId

public function scopeUserId(Builder $query, $userId)

Parameters

TypeNameDescription
Builder$query
int$userId

Returns Builder

scopeOfService

public function scopeOfService(Builder $query, $serviceId)

Parameters

TypeNameDescription
Builder$query
integer$serviceId

Returns Builder

scopeActive

public function scopeActive(Builder $query)

Parameters

TypeNameDescription
Builder$query

Returns Builder

scopeMarketConnect

public function scopeMarketConnect(Builder $query)

Filter for only MarketConnect addon services.

Parameters

TypeNameDescription
Builder$query

Returns Builder

scopeIsConsideredActive

public function scopeIsConsideredActive(Builder $query)

Parameters

TypeNameDescription
Builder$query

Returns Builder

scopeIsNotRecurring

public function scopeIsNotRecurring($query)

Parameters

TypeNameDescription
Builder$query

Returns Builder

service

public function service()

Each addon belongs to one service.

Returns \Illuminate\Database\Eloquent\Relations\BelongsTo

productAddon

public function productAddon()

Each addon belongs to a single product addon.

Returns \Illuminate\Database\Eloquent\Relations\BelongsTo

client

public function client()

Each addon belongs to one client.

Returns \Illuminate\Database\Eloquent\Relations\BelongsTo

customFieldValues

public function customFieldValues()

Returns HasMany\|CustomFieldValue

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

order

public function order()

An addon belongs to a single order.

Returns BelongsTo

paymentGateway

public function paymentGateway()

Each addon has many payment gateway records.

Returns \Illuminate\Database\Eloquent\Relations\HasMany

getServicePropertiesAttribute

public function getServicePropertiesAttribute()

Returns Properties

ssl

public function ssl()

Each addon could have many ssl records.

Returns \Illuminate\Database\Eloquent\Relations\HasMany

invoices

public function invoices(): BelongsToMany

canBeUpgraded

public function canBeUpgraded()

Determine if addon can be upgraded.

Returns bool

isService

public function isService()

Is this entity a service?

Returns bool

isAddon

public function isAddon()

Is this entity an addon?

Returns bool

serverModel

public function serverModel()

Returns \Illuminate\Database\Eloquent\Relations\HasOne

failedActions

public function failedActions()

Returns HasMany

moduleConfiguration

public function moduleConfiguration()

Returns HasMany

legacyProvision

public function legacyProvision()

Run provision action in legacy mode.

Legacy mode returns 'success' on success and an error message string on failure.

Returns string

isProrated

public function isProrated(): bool

isRecurring

public function isRecurring(): bool

Returns bool

isFree

public function isFree(): bool

Returns bool

public function getLink()

recalculateRecurringPrice

public function recalculateRecurringPrice(): float

getProvisioningTypeAttribute

public function getProvisioningTypeAttribute(): string

Returns string

getFirstPaymentAmount

public function getFirstPaymentAmount(): FormatterPrice

getRecurringAmount

public function getRecurringAmount(): FormatterPrice

getBillingCycle

public function getBillingCycle(): string

getPaymentGateway

public function getPaymentGateway(): Gateway

getNextDueDate

public function getNextDueDate(): ?Carbon

getPromotions

public function getPromotions(): SupportCollection

Service's addon does not support promotion at this time but need to return empty collection to meet interface's requirements

Returns SupportCollection

getServiceProduct

public function getServiceProduct(): ?AddonInterface

Returns the associated predefined Addon or an AdHoc addon if the product addon is null

Returns AddonInterface\|null

getInvoicingServiceItemType

public function getInvoicingServiceItemType(): string

getInvoicingServiceFirstPaymentAmount

public function getInvoicingServiceFirstPaymentAmount(): FormatterPrice

getInvoicingServiceRecurringAmount

public function getInvoicingServiceRecurringAmount(): FormatterPrice

isServiceMetricUsage

public function isServiceMetricUsage(): bool

Addon does not support Usage billing at this time

Returns bool