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.
public errors () : Illuminate\Support\MessageBag
Get validation error message collection for the Model
public
forceSave ($options = null
)
: bool
Force save the model even if validation fails.
Property | Type | Description |
---|---|---|
$options | mixed |
mixed
|
public static getModelValidator () : Illuminate\Validation\Validator
Get the validator instance.
public isAttributeRequired (string $attribute) : bool
Determines if an attribute is required based on the validation rules.
Property | Type | Description |
---|---|---|
$attribute | string |
string
|
public static setModelValidator ($validator) : void
Set the validator instance.
Property | Type | Description |
---|---|---|
$validator | mixed |
mixed
|
public static unsetModelValidator () : void
Unset the validator for models.
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
|
public static validated (Closure | string $callback) : void
Create a new native event for handling afterValidate().
Property | Type | Description |
---|---|---|
$callback | Closure | string |
Closure | string
|
public static validating (Closure | string $callback) : void
Create a new native event for handling beforeValidate().
Property | Type | Description |
---|---|---|
$callback | Closure | string |
Closure | string
|
protected getValidationAttributes () : array
Returns the model data used for validation.
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.
Property | Type | Description |
---|---|---|
$data | mixed |
mixed
|
$rules | mixed |
mixed
|
$customMessages | mixed |
mixed
|
$attributeNames | mixed |
mixed
|
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 |
protected processValidationRules ($rules)
Process rules
Property | Type | Description |
---|---|---|
$rules | mixed |
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. |