Documentation

ThemeData extends Model
in package
Uses Validation

Cms\Models\ThemeData

Tags
mixin

\Eloquent

Table of Contents

$attachOne  : array<string|int, mixed>
$created_at  : Carbon|null
$data  : string|null
$id  : int
$rules  : array<string|int, mixed>
$table  : string
$theme  : string|null
$updated_at  : Carbon|null
$fillable  : array<string|int, mixed>
$guarded  : array<string|int, mixed>
$instances  : ThemeData
$jsonable  : array<string|int, mixed>
$validationDefaultAttrNames  : array<string|int, mixed>
$validationErrors  : MessageBag
afterFetch()  : void
After fetching the model, intiialize model relationships based on form field definitions.
afterSave()  : mixed
Clear asset cache after saving to ensure `assetVar` form fields take immediate effect.
all()  :
applyAssetVariablesToCombinerFilters()  : void
Applies asset variables to the combiner filters that support it.
beforeSave()  : void
Before saving the model, strip dynamic attributes applied from config.
beforeValidate()  : void
Before model is validated, set the default values.
bootValidation()  : void
Boot the validation trait for this model.
errors()  : MessageBag
Get validation error message collection for the Model
forceSave()  : bool
Force save the model even if validation fails.
forTheme()  : self
Returns a cached version of this model, based on a Theme object.
get()  :
getAssetVariables()  : array<string|int, mixed>
Returns variables that should be passed to the asset combiner.
getCombinerCacheKey()  : string
Generate a cache key for the combiner, this allows variables to bust the cache.
getDefaultValues()  : array<string|int, mixed>
Gets default values for this model based on form field definitions.
getFormFields()  : array<string|int, mixed>
Returns all fields defined for this model, based on form field definitions.
initFormFields()  : mixed
Creates relationships for this model based on form field definitions.
isAttributeRequired()  : bool
Determines if an attribute is required based on the validation rules.
newModelQuery()  :
newQuery()  :
query()  :
setDefaultValues()  : mixed
Sets default values on this model based on form field definitions.
setValidationAttributeName()  : void
Programatically sets the validation attribute names, will take lower priority to model defined attribute names found in `$attributeNames`.
setValidationAttributeNames()  : void
Programatically sets multiple validation attribute names.
validate()  : bool
Validate the model instance
validated()  : void
Create a new native event for handling afterValidate().
validating()  : void
Create a new native event for handling beforeValidate().
whereCreatedAt()  :
whereData()  :
whereId()  :
whereTheme()  :
whereUpdatedAt()  :
getRelationValidationValue()  : mixed
Attachments validate differently to their simple values.
getValidationAttributes()  : array<string|int, mixed>
Returns the model data used for validation.
makeValidator()  : 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.
processRuleFieldNames()  : array<string|int, mixed>
Processes field names in a rule array.
processValidationRules()  : mixed
Process rules
processValidationUniqueRule()  : string
Rebuilds the unique validation rule to force for the existing ID

Properties

$attachOne

public array<string|int, mixed> $attachOne = []

Relations

$rules

public array<string|int, mixed> $rules = []

The rules to be applied to the data.

$table

public string $table = 'cms_theme_data'

The database table used by the model.

$fillable

protected array<string|int, mixed> $fillable = []

Fillable fields

$guarded

protected array<string|int, mixed> $guarded = []

Guarded fields

$jsonable

protected array<string|int, mixed> $jsonable = ['data']

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

$validationDefaultAttrNames

protected array<string|int, mixed> $validationDefaultAttrNames = []

Default custom attribute names.

$validationErrors

protected MessageBag $validationErrors

The message bag instance containing validation error messages

Methods

afterFetch()

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

public afterFetch() : void
Return values
void

afterSave()

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

public afterSave() : mixed
Return values
mixed

all()

public static all(mixed $columns) :
Parameters
$columns : mixed
Return values

applyAssetVariablesToCombinerFilters()

Applies asset variables to the combiner filters that support it.

public static applyAssetVariablesToCombinerFilters(mixed $filters) : void
Parameters
$filters : mixed
Return values
void

beforeSave()

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

public beforeSave() : void
Return values
void

beforeValidate()

Before model is validated, set the default values.

public beforeValidate() : void
Return values
void

bootValidation()

Boot the validation trait for this model.

public static bootValidation() : void
Return values
void

forceSave()

Force save the model even if validation fails.

public forceSave([mixed $options = null ][, mixed $sessionKey = null ]) : bool
Parameters
$options : mixed = null
$sessionKey : mixed = null
Return values
bool

forTheme()

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

public static forTheme( $theme) : self
Parameters
$theme :

Cms\Classes\Theme

Return values
self

get()

public static get(mixed $columns) :
Parameters
$columns : mixed
Return values

getAssetVariables()

Returns variables that should be passed to the asset combiner.

public getAssetVariables() : array<string|int, mixed>
Return values
array<string|int, mixed>

getCombinerCacheKey()

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

public static getCombinerCacheKey() : string
Return values
string

getDefaultValues()

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

public getDefaultValues() : array<string|int, mixed>
Return values
array<string|int, mixed>

getFormFields()

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

public getFormFields() : array<string|int, mixed>
Return values
array<string|int, mixed>

initFormFields()

Creates relationships for this model based on form field definitions.

public initFormFields() : mixed
Return values
mixed

isAttributeRequired()

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

public isAttributeRequired(string $attribute[, bool $checkDependencies = true ]) : bool
Parameters
$attribute : string
$checkDependencies : bool = true

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

Return values
bool

newModelQuery()

public static newModelQuery() :
Return values

newQuery()

public static newQuery() :
Return values

query()

public static query() :
Return values

setDefaultValues()

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

public setDefaultValues() : mixed
Return values
mixed

setValidationAttributeName()

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

public setValidationAttributeName(string $attr, string $name) : void
Parameters
$attr : string
$name : string
Return values
void

setValidationAttributeNames()

Programatically sets multiple validation attribute names.

public setValidationAttributeNames(array<string|int, mixed> $attributeNames) : void
Parameters
$attributeNames : array<string|int, mixed>
Return values
void

validate()

Validate the model instance

public validate([mixed $rules = null ][, mixed $customMessages = null ][, mixed $attributeNames = null ]) : bool
Parameters
$rules : mixed = null
$customMessages : mixed = null
$attributeNames : mixed = null
Return values
bool

validated()

Create a new native event for handling afterValidate().

public static validated(Closure|string $callback) : void
Parameters
$callback : Closure|string
Return values
void

validating()

Create a new native event for handling beforeValidate().

public static validating(Closure|string $callback) : void
Parameters
$callback : Closure|string
Return values
void

whereCreatedAt()

public static whereCreatedAt(mixed $value) :
Parameters
$value : mixed
Return values

whereData()

public static whereData(mixed $value) :
Parameters
$value : mixed
Return values

whereId()

public static whereId(mixed $value) :
Parameters
$value : mixed
Return values

whereTheme()

public static whereTheme(mixed $value) :
Parameters
$value : mixed
Return values

whereUpdatedAt()

public static whereUpdatedAt(mixed $value) :
Parameters
$value : mixed
Return values

getRelationValidationValue()

Attachments validate differently to their simple values.

protected getRelationValidationValue(mixed $relationName) : mixed
Parameters
$relationName : mixed
Return values
mixed

getValidationAttributes()

Returns the model data used for validation.

protected getValidationAttributes() : array<string|int, mixed>
Return values
array<string|int, mixed>

makeValidator()

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.

protected static makeValidator(mixed $data, mixed $rules, mixed $customMessages, mixed $attributeNames[, mixed $connection = null ]) : Validator
Parameters
$data : mixed
$rules : mixed
$customMessages : mixed
$attributeNames : mixed
$connection : mixed = null
Return values
Validator

processRuleFieldNames()

Processes field names in a rule array.

protected processRuleFieldNames(array<string|int, mixed> $rules) : array<string|int, mixed>

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

Parameters
$rules : array<string|int, mixed>

Rules array

Return values
array<string|int, mixed>

processValidationRules()

Process rules

protected processValidationRules(mixed $rules) : mixed
Parameters
$rules : mixed
Return values
mixed

processValidationUniqueRule()

Rebuilds the unique validation rule to force for the existing ID

protected processValidationUniqueRule(string $definition, string $fieldName) : string
Parameters
$definition : string
$fieldName : string
Return values
string

Search results