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

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

List of attribute names which are json encoded and decoded from the database.

inherited protected $validationDefaultAttrNames : array

Inherited from Validation

Default custom attribute names.

inherited protected $validationErrors : Illuminate\Support\MessageBag

Inherited from Validation

The message bag instance containing validation error messages

Methods

public afterFetch () : void

After fetching the model, intiialize model relationships based on form field definitions.

Returns
void

public afterSave ()

Clear asset cache after saving to ensure assetVar form fields take immediate effect.

Returns
mixed

public static applyAssetVariablesToCombinerFilters ($filters) : void

Applies asset variables to the combiner filters that support it.

Parameters
Property Description
$filters
mixed
Returns
void

public beforeSave () : void

Before saving the model, strip dynamic attributes applied from config.

Returns
void

public beforeValidate () : void

Before model is validated, set the default values.

Returns
void

public static forTheme (mixed $theme) : self

Returns a cached version of this model, based on a Theme object.

Parameters
Property Description
$theme
mixed

Cms\Classes\Theme

Returns
self

public getAssetVariables () : array

Returns variables that should be passed to the asset combiner.

Returns
array

public static getCombinerCacheKey () : string

Generate a cache key for the combiner, this allows variables to bust the cache.

Returns
string

public getDefaultValues () : array

Gets default values for this model based on form field definitions.

Returns
array

public getFormFields () : array

Returns all fields defined for this model, based on form field definitions.

Returns
array

public initFormFields ()

Creates relationships for this model based on form field definitions.

Returns
mixed

public setDefaultValues ()

Sets default values on this model based on form field definitions.

Returns
mixed

inherited public static bootValidation () : void

Inherited from Validation

Boot the validation trait for this model.

Returns
void

inherited public errors () : Illuminate\Support\MessageBag

Inherited from Validation

Get validation error message collection for the Model

Returns
Illuminate\Support\MessageBag

inherited public forceSave ($options = null, $sessionKey = null) : bool

Inherited from Validation

Force save the model even if validation fails.

Parameters
Property Description
$options
mixed
$sessionKey
mixed
Returns
bool

inherited public isAttributeRequired (string $attribute, boolean $checkDependencies = true) : bool

Inherited from Validation

Determines if an attribute is required based on the validation rules.

Parameters
Property Description
$attribute
string
$checkDependencies
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

Returns
bool

inherited public setValidationAttributeName (string $attr, string $name) : void

Inherited from Validation

Programatically sets the validation attribute names, will take lower priority to model defined attribute names found in $attributeNames.

Parameters
Property Description
$attr
string
$name
string
Returns
void

inherited public setValidationAttributeNames (array $attributeNames) : void

Inherited from Validation

Programatically sets multiple validation attribute names.

Parameters
Property Description
$attributeNames
array
Returns
void

inherited public validate ($rules = null, $customMessages = null, $attributeNames = null) : bool

Inherited from Validation

Validate the model instance

Parameters
Property Description
$rules
mixed
$customMessages
mixed
$attributeNames
mixed
Returns
bool

inherited public static validated (Closure | string $callback) : void

Inherited from Validation

Create a new native event for handling afterValidate().

Parameters
Property Description
$callback
Closure | string
Returns
void

inherited public static validating (Closure | string $callback) : void

Inherited from Validation

Create a new native event for handling beforeValidate().

Parameters
Property Description
$callback
Closure | string
Returns
void

inherited protected getRelationValidationValue ($relationName)

Inherited from Validation

Attachments validate differently to their simple values.

Parameters
Property Description
$relationName
mixed
Returns
mixed

inherited protected getValidationAttributes () : array

Inherited from Validation

Returns the model data used for validation.

Returns
array

inherited protected static makeValidator ($data, $rules, $customMessages, $attributeNames, $connection = null) : Illuminate\Contracts\Validation\Validator

Inherited from Validation

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.

Parameters
Property Description
$data
mixed
$rules
mixed
$customMessages
mixed
$attributeNames
mixed
$connection
mixed
Returns
Illuminate\Contracts\Validation\Validator

inherited protected processRuleFieldNames (array $rules) : array

Inherited from Validation

Processes field names in a rule array.

Converts any field names using array notation (ie. field[child]) into dot notation (ie. field.child)

Parameters
Property Description
$rules
array

Rules array

Returns
array

inherited protected processValidationRules ($rules)

Inherited from Validation

Process rules

Parameters
Property Description
$rules
mixed
Returns
mixed

inherited protected processValidationUniqueRule (string $definition, string $fieldName) : string

Inherited from Validation

Rebuilds the unique validation rule to force for the existing ID

Parameters
Property Description
$definition
string
$fieldName
string
Returns
string
Copyright © 2024 Winter CMS