ThemeData
Customization data used by a theme
class Cms\Models\ThemeData
extends Model
Extends
Class | Description |
---|---|
Model
|
Traits
Trait | Description |
---|---|
Validation
|
Properties
public
$attachOne
:
array
= []
Relations
public
$rules
:
array
= []
The rules to be applied to the data.
public
$table
:
string
= "cms_theme_data"
The database table used by the model.
protected
$fillable
:
array
= []
Fillable fields
protected
$guarded
:
array
= []
Guarded fields
protected
static
$instances
:
ThemeData
= []
Cached array of objects
protected
$jsonable
:
array
= ["data"]
List of attribute names which are json encoded and decoded from the database.
inherited
protected
$validationDefaultAttrNames
:
array
= []
Default custom attribute names.
inherited protected $validationErrors : Illuminate\Support\MessageBag
The message bag instance containing validation error messages
Methods
public afterFetch () : void
After fetching the model, intiialize model relationships based on form field definitions.
public afterSave ()
Clear asset cache after saving to ensure assetVar
form fields take
immediate effect.
public static applyAssetVariablesToCombinerFilters ($filters) : void
Applies asset variables to the combiner filters that support it.
Property | Type | Description |
---|---|---|
$filters | mixed |
mixed
|
public beforeSave () : void
Before saving the model, strip dynamic attributes applied from config.
public beforeValidate () : void
Before model is validated, set the default values.
public static forTheme (mixed $theme) : self
Returns a cached version of this model, based on a Theme object.
Property | Type | Description |
---|---|---|
$theme | mixed |
mixed
Cms\Classes\Theme |
public getAssetVariables () : array
Returns variables that should be passed to the asset combiner.
public static getCombinerCacheKey () : string
Generate a cache key for the combiner, this allows variables to bust the cache.
public getDefaultValues () : array
Gets default values for this model based on form field definitions.
public getFormFields () : array
Returns all fields defined for this model, based on form field definitions.
public initFormFields ()
Creates relationships for this model based on form field definitions.
public setDefaultValues ()
Sets default values on this model based on form field definitions.
inherited public static bootValidation () : void
Boot the validation trait for this model.
inherited public errors () : Illuminate\Support\MessageBag
Get validation error message collection for the Model
inherited
public
forceSave ($options = null
, $sessionKey = null
)
: bool
Force save the model even if validation fails.
Property | Type | Description |
---|---|---|
$options | mixed |
mixed
|
$sessionKey | mixed |
mixed
|
inherited
public
isAttributeRequired (string $attribute, boolean $checkDependencies = true
)
: bool
Determines if an attribute is required based on the validation rules.
Property | Type | Description |
---|---|---|
$attribute | string |
string
|
$checkDependencies | boolean |
boolean
Checks the attribute dependencies (for required_if & required_with rules). Note that it will only be checked up to the next level, if another dependent rule is found then it will just assume the field is required |
inherited public setValidationAttributeName (string $attr, string $name) : void
Programatically sets the validation attribute names, will take lower priority
to model defined attribute names found in $attributeNames
.
Property | Type | Description |
---|---|---|
$attr | string |
string
|
$name | string |
string
|
inherited public setValidationAttributeNames (array $attributeNames) : void
Programatically sets multiple validation attribute names.
Property | Type | Description |
---|---|---|
$attributeNames | array |
array
|
inherited
public
validate ($rules = null
, $customMessages = null
, $attributeNames = null
)
: bool
Validate the model instance
Property | Type | Description |
---|---|---|
$rules | mixed |
mixed
|
$customMessages | mixed |
mixed
|
$attributeNames | mixed |
mixed
|
inherited public static validated (Closure | string $callback) : void
Create a new native event for handling afterValidate().
Property | Type | Description |
---|---|---|
$callback | Closure | string |
Closure | string
|
inherited public static validating (Closure | string $callback) : void
Create a new native event for handling beforeValidate().
Property | Type | Description |
---|---|---|
$callback | Closure | string |
Closure | string
|
inherited protected getRelationValidationValue ($relationName)
Attachments validate differently to their simple values.
Property | Type | Description |
---|---|---|
$relationName | mixed |
mixed
|
inherited protected getValidationAttributes () : array
Returns the model data used for validation.
inherited
protected
static
makeValidator ($data, $rules, $customMessages, $attributeNames, $connection = null
)
: Illuminate\Contracts\Validation\Validator
Instantiates the validator used by the validation process, depending if the class is being used inside or outside of Laravel. Optional connection string to make the validator use a different database connection than the default connection.
Property | Type | Description |
---|---|---|
$data | mixed |
mixed
|
$rules | mixed |
mixed
|
$customMessages | mixed |
mixed
|
$attributeNames | mixed |
mixed
|
$connection | mixed |
mixed
|
inherited protected processRuleFieldNames (array $rules) : array
Processes field names in a rule array.
Converts any field names using array notation (ie. field[child]
) into dot notation (ie. field.child
)
Property | Type | Description |
---|---|---|
$rules | array |
array
Rules array |
inherited protected processValidationRules ($rules)
Process rules
Property | Type | Description |
---|---|---|
$rules | mixed |
mixed
|
inherited protected processValidationUniqueRule (string $definition, string $fieldName) : string
Rebuilds the unique validation rule to force for the existing ID
Property | Type | Description |
---|---|---|
$definition | string |
string
|
$fieldName | string |
string
|