Class · extends AbstractModel
Custom Fields model class
| Name | Description |
|---|---|
TYPE_ADDON | |
TYPE_CLIENT | |
TYPE_PRODUCT | |
TYPE_SUPPORT |
public static function boot()public function scopeClientFields(Builder $query)Obtain all the client custom fields
Parameters
| Type | Name | Description |
|---|---|---|
Builder | $query |
Returns Builder
public function scopeProductFields(Builder $query, $productId)Obtain all the product custom fields for a specific product.
Parameters
| Type | Name | Description |
|---|---|---|
Builder | $query | |
int | $productId |
Returns Builder
public function scopeSupportFields(Builder $query, $departmentId)Obtain all the support custom fields for a specific support department.
Parameters
| Type | Name | Description |
|---|---|---|
Builder | $query | |
int | $departmentId |
Returns Builder
public function scopeAddonFields(Builder $query, $addonId)Obtain all the addon custom fields for a specific addon id.
Parameters
| Type | Name | Description |
|---|---|---|
Builder | $query | |
int | $addonId |
Returns Builder
public function product()A custom field can belong to a single product
Returns HasOne\|Product
public function addon()A custom field can belong to a single product addon.
Returns HasOne\|Addon
public function getFieldNameAttribute($fieldName)Get the custom field's name - this will override the output from the db value if set in Lang.
Parameters
| Type | Name | Description |
|---|---|---|
string | $fieldName | The value from the database |
Returns string
public function getDescriptionAttribute($description)Get the custom field's name - 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 customFieldValues()Returns HasMany\|CustomFieldValue
public static function getFieldName($fieldId, $fallback = '', $language = null)Obtain the custom field name for the current language, passed language or fallback to the currently defined value for the product group.
Parameters
| Type | Name | Description |
|---|---|---|
int | $fieldId | |
string | $fallback | |
string | $language |
Returns string
public function getFriendlyDisplayFieldName(): ?stringAttempt to retrieve an alternate field name that is embedded within this object’s fieldName
Returns string\|null
public function hasFriendlyDisplayFieldName(): boolDetermines if an alternate field name is embedded within this object’s fieldName, if dynamic translations are enabled
Returns bool
public function getFieldNameTranslation(?string $language, bool $assumeEnabled = false): ?stringAttempt to retrieve a dynamic translation of this object's fieldName
Parameters
| Type | Name | Description |
|---|---|---|
null|string | $language | |
bool | $assumeEnabled | Attempt translation despite dynamic translations possibly being disabled |
Returns null\|string
public static function getDescription($fieldId, $fallback = '', $language = null)Obtain the custom field description for the current language, passed language or fallback to the currently defined value for the product group.
Parameters
| Type | Name | Description |
|---|---|---|
int | $fieldId | |
string | $fallback | |
string | $language |
Returns string
public function scopeRequired(Builder $query): Builderpublic function scopeOnOrderShow(Builder $query): Builderpublic function scopeOnOrderHide(Builder $query): Builderpublic function scopeAdminOnly(Builder $query): Builderpublic function scopeNotAdminOnly(Builder $query): Builderpublic function scopeShowOnOrderForm(Builder $query): Builderpublic static function commonQueryBuilder($type, $relid = 0, bool $onOrderOnly = false)Initialize a query for custom fields that outlines common requirements and default behaviors.
Parameters
| Type | Name | Description |
|---|---|---|
string | $type | Type of custom field |
int | $relid | Optionally limit fields to those associated with the $type's ID. |
bool | $onOrderOnly | true=include on fields with "show on order" or "required" enabled. A "required" field is assumed to also be present in any context "show on order" enabled fields are. false=no additional criteria related to "show on order" or "required". |
Returns Builder
public function getType(): ?stringpublic function getOptions(): array