CustomField
Custom Fields model class
Properties summary
Type | Property | Description | |
---|---|---|---|
protected | $table | ||
protected | $columnMap | ||
protected | $commaSeparated | ||
protected | $fillable | Define the fields that can be hydrated by a firstOrNew call. | |
int | $id | A custom fields unique identifier | |
string | $type | The type of custom field client|product|support|addon | |
int | $relatedId | The related id of the custom field type | |
string | $fieldName | The name of the custom field | |
string | $fieldType | The type of the custom field dropdown|link|text|textarea|tickbox|password | |
string | $description | The description of the custom field | |
string[] | $fieldOptions | The options available for the dropdown type | |
string | $regularExpression | The Regular Expression Validation String | |
string | $adminOnly | Is the field only visible for Admins | |
string | $required | Is the field required | |
string | $showOrder | Should the field show in the orderForm | |
string | $showInvoice | Should the field show on the invoice | |
int | $sortOrder | The order the field should be displayed | |
Carbon | $createdAt | The date a custom field was created. | |
Carbon | $updatedAt | The date a custom field was last modified. | |
Collection|Product | $product | The product a custom field belongs to | |
Collection|Addon | $addon | The product addon a custom field belongs to | |
Collection|CustomFieldValue | $customFieldValues | The custom field values for this custom field |
Methods summary
Return Type | Method Name | Description | |
---|---|---|---|
static | boot() | - | |
Builder | scopeClientFields(Builder $query) | Obtain all the client custom fields | |
Builder | scopeProductFields(Builder $query, int $productId) | Obtain all the product custom fields for a specific product. | |
Builder | scopeSupportFields(Builder $query, int $departmentId) | Obtain all the support custom fields for a specific support department. | |
Builder | scopeAddonFields(Builder $query, int $addonId) | Obtain all the addon custom fields for a specific addon id. | |
HasOne|Product | product() | A custom field can belong to a single product | |
HasOne|Addon | addon() | A custom field can belong to a single product addon. | |
string | getFieldNameAttribute(string $fieldName) | Get the custom field's name - this will override the output from the db value if set in Lang. | |
string | getDescriptionAttribute(string $description) | Get the custom field's name - this will override the output from the db value if set in Lang. | |
HasMany|CustomFieldValue | customFieldValues() | - | |
static string | getFieldName(int $fieldId, string $fallback = '', string $language = null) | Obtain the custom field name for the current language, passed language or fallback to the currently defined value for the product group. | |
static string | getDescription(int $fieldId, string $fallback = '', string $language = null) | Obtain the custom field description for the current language, passed language or fallback to the currently defined value for the product group. |
Details
static
boot ()
Builder
scopeClientFields (Builder $query)
Obtain all the client custom fields
Builder
scopeProductFields (Builder $query, int $productId)
Obtain all the product custom fields for a specific product.
Builder
scopeSupportFields (Builder $query, int $departmentId)
Obtain all the support custom fields for a specific support department.
Builder
scopeAddonFields (Builder $query, int $addonId)
Obtain all the addon custom fields for a specific addon id.
HasOne|Product
product ()
A custom field can belong to a single product
HasOne|Addon
addon ()
A custom field can belong to a single product addon.
string
getFieldNameAttribute (string $fieldName)
Get the custom field's name - this will override the output from the db value if set in Lang.
string
getDescriptionAttribute (string $description)
Get the custom field's name - this will override the output from the db value if set in Lang.
HasMany|CustomFieldValue
customFieldValues ()
static string
getFieldName (int $fieldId, string $fallback = '', string $language = null)
Obtain the custom field name for the current language, passed language or fallback to the currently defined value for the product group.
static string
getDescription (int $fieldId, string $fallback = '', string $language = null)
Obtain the custom field description for the current language, passed language or fallback to the currently defined value for the product group.