Class · extends AbstractModel · implements PricedEntityInterface, AddonInterface
tbladdons model class
BillingTraitMarketConnectTraitOnDemandRenewalTrait
| Name | Description |
|---|---|
PROVISIONING_TYPE_FEATURE | |
PROVISIONING_TYPE_STANDARD |
public static function boot()public function scopeProductId(Builder $query, int $productId): BuilderGet all addon available for a given product id
Parameters
| Type | Name | Description |
|---|---|---|
Builder | $query | |
int | $productId |
Returns Builder
public function scopeShowOnOrderForm(Builder $query)A scope to show Addons available on OrderForm
Parameters
| Type | Name | Description |
|---|---|---|
Builder | $query |
Returns Builder
public function scopeIsHidden(Builder $query)A scope to show Addons hidden on OrderForm
Parameters
| Type | Name | Description |
|---|---|---|
Builder | $query |
Returns Builder
public function scopeIsNotHidden(Builder $query)A scope to show Addons not hidden on OrderForm
Parameters
| Type | Name | Description |
|---|---|---|
Builder | $query |
Returns Builder
public function scopeIsRetired(Builder $query)A scope to show Addons that should not be displayed on OrderForm
Parameters
| Type | Name | Description |
|---|---|---|
Builder | $query |
Returns Builder
public function scopeIsNotRetired(Builder $query)A scope to show Addons that may be displayed on OrderForm
Parameters
| Type | Name | Description |
|---|---|---|
Builder | $query |
Returns Builder
public function scopeAvailableOnOrderForm(Builder $query, array $addons = [])A scope to show Addons available on OrderForm using hidden and show on order options.
Parameters
| Type | Name | Description |
|---|---|---|
Builder | $query | |
int[] | $addons | An array of addon ids that should be preselected on OrderForm. |
Returns Builder
public function scopeSorted($query)Sort by display order.
Returns Builder
public function welcomeEmailTemplate()An addon has one welcome email template.
Returns \Illuminate\Database\Eloquent\Relations\HasOne
public function getNameAttribute($name)Get the addon name - this will override the output from the db value if set in Lang.
Parameters
| Type | Name | Description |
|---|---|---|
string | $name | The value from the database |
Returns string
public function getDescriptionAttribute($description)Get the addon description - this will override the output from the db value if set in Lang.
Parameters
| Type | Name | Description |
|---|---|---|
string | $description | The value from the database |
Returns string
public function customFields()Returns \Illuminate\Database\Eloquent\Relations\HasMany
public function serviceAddons()Returns \Illuminate\Database\Eloquent\Relations\HasMany
public function dbPricing(): HasManypublic function moduleConfiguration()Returns \Illuminate\Database\Eloquent\Relations\HasMany
public function translatedNames()Return the translated names for the specific addon
Returns \Illuminate\Database\Eloquent\Relations\HasMany\|\WHMCS\Language\DynamicTranslation[]
public function translatedDescriptions()Return the translated names for the specific addon
Returns \Illuminate\Database\Eloquent\Relations\HasMany\|\WHMCS\Language\DynamicTranslation[]
public static function getAddonName($addonId, $fallback = '', $language = null)Obtain the addon name for the current language, passed language or fallback to the currently defined value for the product.
Parameters
| Type | Name | Description |
|---|---|---|
int | $addonId | |
string | $fallback | - override the language fallback value |
string | $language |
Returns string
public static function getAddonDescription($addonId, $fallback = '', $language = null)Obtain the addon description for the current language, passed language or fallback to the currently defined value for the product.
Parameters
| Type | Name | Description |
|---|---|---|
int | $addonId | |
string | $fallback | |
string | $language |
Returns string
public function pricing($currency = null): PricingGet available cycles and pricing for addon.
Parameters
| Type | Name | Description |
|---|---|---|
array|null | $currency | Only required on first call. |
Returns Pricing
public function isFree(): boolIs product a free product.
Returns bool
public function isOneTime(): boolIs product a one time product.
Returns bool
public function scopeMarketConnect(Builder $query)Quick filter for module = marketconnect.
Parameters
| Type | Name | Description |
|---|---|---|
Builder | $query |
Returns Builder
public function getProductKeyAttribute()Get product key attribute for the current product addon entity.
Returns string
public function isMarketConnectAddon()Is this a MarketConnect addon?
Returns bool
public function getServiceKeyAttribute($value)Get service key attribute for the current product addon entity.
Parameters
| Type | Name | Description |
|---|---|---|
string | $value |
Returns string
public function isValidForUpgrade(Addon $addon)Validate a given addon is a valid upgrade candidate.
For MarketConnect, validates upgrade product service key matches current product key.
Parameters
| Type | Name | Description |
|---|---|---|
Addon | $addon |
Returns bool
public function isVisibleOnOrderForm(array $addonIds = [])Check if the addon should be visible on the orderform.
Parameters
| Type | Name | Description |
|---|---|---|
int[] | $addonIds | An array of addonids to preselect on the orderform |
Returns bool
public static function getAddonDropdownValues(int $currentAddonId = 0): arrayGet an array of id => name addons that should appear in an addon dropdown.
Parameters
| Type | Name | Description |
|---|---|---|
int | $currentAddonId |
Returns array
public function emailMarketerRules()public function getAvailableBillingCycles(): arrayGet available billing cycles for product.
Returns string[]
public function duplicate(string $newAddonName): AddonReplicate Product Addon and Pricing. New object uses provided string as name.
Parameters
| Type | Name | Description |
|---|---|---|
string | $newAddonName |
Returns Addon
public function getProvisioningTypeAttribute(): stringReturns string
public function getOrderLineItemProductGroupName(): stringpublic function overrideOnDemandRenewal(): HasOneOn-demand renewal override settings if not null
Returns HasOne
public function overridingOnDemandRenewal(bool $enable, int $monthly, int $quarterly, int $semiannually, int $annually, int $biennially, int $triennially): selfOverride on-demand renewal settings
Parameters
| Type | Name | Description |
|---|---|---|
bool | $enable | |
int | $monthly | |
int | $quarterly | |
int | $semiannually | |
int | $annually | |
int | $biennially | |
int | $triennially |
Returns Addon