tbladdons model class

class Addon extends AbstractModel

Traits

MarketConnectTrait

Properties summary

Type Property Description
protected $table
protected $moduleField
protected $columnMap
protected $booleans
protected $commaSeparated
protected $casts
protected $pricingCache
int $id An addon's unique id number.
int[] $packages The packages that an addon belongs to
string $name The name of an addon
string $description The description of an addon
string $billingCycle The billing cycle of an addon
int $allowMultipleQuantities Are quantities supported for the Addon. 0 = no, 2 = Unit quantities
boolean $applyTax Whether or not tax should be applied to an addon.
boolean $showOnOrderForm Whether an addon will appear on order of a related product
boolean $isHidden Whether an addon is hidden from order in the client area
boolean $retired Whether or not an addon is retired and should no longer be sold.
int[] $downloads The associated downloads
string $autoActivate When provisioning of an addon should take place, either "order", "payment", "on", or "".
boolean $suspendProduct Should suspending the addon, suspend the parent product
int $welcomeEmailTemplateId The welcome email template id
string $type The type of addon for module automation (hostingaccount, reselleraccount, server, other)
string $module The module for an addon for module automation
int $serverGroupId The id number of server group an addon should be provisioned to.
int $weight The display order weighting
array $autoLinkCriteria An array of criterias for choosing products to auto-assign this addon to if allowed by admin
Collection|ModuleConfiguration[] $moduleConfiguration The module configuration for an addon.
Collection|Addon[] $serviceAddons The service addons utilising this addon.
Collection|CustomField[] $customFields The custom fields for an addon.
Template $welcomeEmailTemplate The email to send to a client when a product is ordered.
Collection|DynamicTranslation[] $translatedNames
Collection|DynamicTranslation[] $translatedDescriptions
BelongsToMany|EmailMarketer[] $emailMarketerRules

Methods summary

Return Type Method Name Description
static  boot() -
Builder scopeShowOnOrderForm(Builder $query) A scope to show Addons available on OrderForm
Builder scopeIsHidden(Builder $query) A scope to show Addons hidden on OrderForm
Builder scopeIsNotHidden(Builder $query) A scope to show Addons not hidden on OrderForm
Builder scopeIsRetired(Builder $query) A scope to show Addons that should not be displayed on OrderForm
Builder scopeIsNotRetired(Builder $query) A scope to show Addons that may be displayed on OrderForm
Builder scopeAvailableOnOrderForm(Builder $query, array $addons = []) A scope to show Addons available on OrderForm using hidden and show on order options.
Builder scopeSorted($query) Sort by display order.
HasOne welcomeEmailTemplate() An addon has one welcome email template.
string getNameAttribute(string $name) Get the addon name - this will override the output from the db value if set in Lang.
string getDescriptionAttribute(string $description) Get the addon description - this will override the output from the db value if set in Lang.
HasMany customFields() -
HasMany serviceAddons() -
HasMany moduleConfiguration() -
HasMany|DynamicTranslation[] translatedNames() Return the translated names for the specific addon
HasMany|DynamicTranslation[] translatedDescriptions() Return the translated names for the specific addon
static string getAddonName(int $addonId, string $fallback = '', string $language = null) Obtain the addon name for the current language, passed language or fallback to the currently defined value for the product.
static string getAddonDescription(int $addonId, string $fallback = '', string $language = null) Obtain the addon description for the current language, passed language or fallback to the currently defined value for the product.
Pricing pricing(array|null $currency = null) Get available cycles and pricing for addon.
bool isFree() Is product a free product.
bool isOneTime() Is product a one time product.
Builder scopeMarketConnect(Builder $query) Quick filter for module = marketconnect.
string getProductKeyAttribute(string $value) Get product key attribute for the current product addon entity.
bool isMarketConnectAddon() Is this a MarketConnect addon?
string getServiceKeyAttribute(string $value) Get service key attribute for the current product addon entity.
bool isValidForUpgrade(Addon $addon) Validate a given addon is a valid upgrade candidate.
bool isVisibleOnOrderForm(array $addonIds = []) Check if the addon should be visible on the orderform.
static array getAddonDropdownValues(int $currentAddonId) Get an array of id => name addons that should appear in an addon dropdown.
emailMarketerRules() -
string[] getAvailableBillingCycles() Get available billing cycles for product.

Details

static boot ()

Builder scopeShowOnOrderForm (Builder $query)

A scope to show Addons available on OrderForm

Parameters

Builder $query

Return Value

Builder

Builder scopeIsHidden (Builder $query)

A scope to show Addons hidden on OrderForm

Parameters

Builder $query

Return Value

Builder

Builder scopeIsNotHidden (Builder $query)

A scope to show Addons not hidden on OrderForm

Parameters

Builder $query

Return Value

Builder

Builder scopeIsRetired (Builder $query)

A scope to show Addons that should not be displayed on OrderForm

Parameters

Builder $query

Return Value

Builder

Builder scopeIsNotRetired (Builder $query)

A scope to show Addons that may be displayed on OrderForm

Parameters

Builder $query

Return Value

Builder

Builder scopeAvailableOnOrderForm (Builder $query, array $addons = [])

A scope to show Addons available on OrderForm using hidden and show on order options.

Parameters

Builder $query
array $addons An array of addon ids that should be preselected on OrderForm.

Return Value

Builder

Builder scopeSorted ($query)

Sort by display order.

Parameters

$query

Return Value

Builder

HasOne welcomeEmailTemplate ()

An addon has one welcome email template.

Return Value

HasOne

string getNameAttribute (string $name)

Get the addon name - this will override the output from the db value if set in Lang.

Parameters

string $name The value from the database

Return Value

string

string getDescriptionAttribute (string $description)

Get the addon description - this will override the output from the db value if set in Lang.

Parameters

string $description The value from the database

Return Value

string

HasMany customFields ()

Return Value

HasMany

HasMany serviceAddons ()

Return Value

HasMany

HasMany moduleConfiguration ()

Return Value

HasMany

HasMany|DynamicTranslation[] translatedNames ()

Return the translated names for the specific addon

Return Value

HasMany|DynamicTranslation[]

HasMany|DynamicTranslation[] translatedDescriptions ()

Return the translated names for the specific addon

Return Value

HasMany|DynamicTranslation[]

static string getAddonName (int $addonId, string $fallback = '', string $language = null)

Obtain the addon name for the current language, passed language or fallback to the currently defined value for the product.

Parameters

int $addonId
string $fallback
  • override the language fallback value
string $language

Return Value

string

static string getAddonDescription (int $addonId, string $fallback = '', string $language = null)

Obtain the addon description for the current language, passed language or fallback to the currently defined value for the product.

Parameters

int $addonId
string $fallback
string $language

Return Value

string

Pricing pricing (array|null $currency = null)

Get available cycles and pricing for addon.

Parameters

array|null $currency Only required on first call.

Return Value

Pricing

Exceptions

Exception

bool isFree ()

Is product a free product.

Return Value

bool

bool isOneTime ()

Is product a one time product.

Return Value

bool

Builder scopeMarketConnect (Builder $query)

Quick filter for module = marketconnect.

Parameters

Builder $query

Return Value

Builder

string getProductKeyAttribute (string $value)

Get product key attribute for the current product addon entity.

Parameters

string $value

Return Value

string

bool isMarketConnectAddon ()

Is this a MarketConnect addon?

Return Value

bool

string getServiceKeyAttribute (string $value)

Get service key attribute for the current product addon entity.

Parameters

string $value

Return Value

string

bool isValidForUpgrade (Addon $addon)

Validate a given addon is a valid upgrade candidate.

For MarketConnect, validates upgrade product service key matches current product key.

Parameters

Addon $addon

Return Value

bool

bool isVisibleOnOrderForm (array $addonIds = [])

Check if the addon should be visible on the orderform.

Parameters

array $addonIds An array of addonids to preselect on the orderform

Return Value

bool

static array getAddonDropdownValues (int $currentAddonId)

Get an array of id => name addons that should appear in an addon dropdown.

Parameters

int $currentAddonId

Return Value

array

emailMarketerRules ()

string[] getAvailableBillingCycles ()

Get available billing cycles for product.

Return Value

string[]