Validation

 trait Winter\Storm\Halcyon\Traits\Validation

Properties

protected $validationErrors : Illuminate\Support\MessageBag

The message bag instance containing validation error messages

protected static $validator : Illuminate\Validation\Validator

The validator instance.

Methods

public static bootValidation () : void

Boot the validation trait for this model.

Returns
void

public errors () : Illuminate\Support\MessageBag

Get validation error message collection for the Model

Returns
Illuminate\Support\MessageBag

public forceSave ($options = null) : bool

Force save the model even if validation fails.

Parameters
Property Description
$options
mixed
Returns
bool

public static getModelValidator () : Illuminate\Validation\Validator

Get the validator instance.

Returns
Illuminate\Validation\Validator

public isAttributeRequired (string $attribute) : bool

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

Parameters
Property Description
$attribute
string
Returns
bool

public static setModelValidator ($validator) : void

Set the validator instance.

Parameters
Property Description
$validator
mixed
Returns
void

public static unsetModelValidator () : void

Unset the validator for models.

Returns
void

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

Validate the model instance

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

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

Create a new native event for handling afterValidate().

Parameters
Property Description
$callback
Closure | string
Returns
void

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

Create a new native event for handling beforeValidate().

Parameters
Property Description
$callback
Closure | string
Returns
void

protected getValidationAttributes () : array

Returns the model data used for validation.

Returns
array

protected static makeValidator ($data, $rules, $customMessages, $attributeNames) : Illuminate\Validation\Validator

Instantiates the validator used by the validation process, depending if the class is being used inside or outside of Laravel.

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

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)

Parameters
Property Description
$rules
array

Rules array

Returns
array

protected processValidationRules ($rules)

Process rules

Parameters
Property Description
$rules
mixed
Returns
mixed

Used by

Class Description
CmsCompoundObject

This is a base class for CMS objects that have multiple sections - pages, partials and layouts.

CmsObject

This is a base class for all CMS objects - content files, pages, partials and layouts.

Content

The CMS content file class.

Layout

The CMS layout class.

Meta

The CMS meta file class, used for interacting with YAML files within the Halcyon datasources

Page

The CMS page class.

Partial

The CMS partial class.

Theme

This class represents the CMS theme.

Copyright © 2024 Winter CMS