PHP Класс Overtrue\Validation\Validator

Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$after array All of the registered "after" callbacks.
$customAttributes array The array of custom attribute names.
$customMessages array The array of custom error messages.
$customValues array The array of custom displayabled values.
$data array The data under validation.
$extensions array All of the custom validator extensions.
$failedRules array The failed validation rules.
$fallbackMessages array The array of fallback error messages.
$files array The files under validation.
$implicitRules array The validation rules that imply the field is required.
$messages MessageBag The messages.
$numericRules array The numeric related validation rules.
$presenceVerifier Overtrue\Validation\PresenceVerifierInterface The Presence Verifier implementation.
$replacers array All of the custom replacer extensions.
$rules array The rules to be applied to the data.
$sizeRules array The size related validation rules.
$translator Overtrue\Validation\TranslatorInterface The Translator implementation.

Открытые методы

Метод Описание
__call ( string $method, array $parameters ) : mixed Handle dynamic calls to class methods.
__construct ( Overtrue\Validation\TranslatorInterface $translator, array $data, array $rules, array $messages = [], array $customAttributes = [] ) : Validator Create a new Validator instance.
addCustomAttributes ( array $customAttributes ) Add custom attributes to the validator.
addCustomValues ( array $customValues ) Add the custom values for the validator.
addExtension ( string $rule, Closure | string $extension ) Register a custom validator extension.
addExtensions ( array $extensions ) Register an array of custom validator extensions.
addImplicitExtension ( string $rule, Closure | string $extension ) Register a custom implicit validator extension.
addImplicitExtensions ( array $extensions ) Register an array of custom implicit validator extensions.
addReplacer ( string $rule, Closure | string $replacer ) Register a custom validator message replacer.
addReplacers ( array $replacers ) Register an array of custom validator message replacers.
after ( callable | string $callback ) After an after validation callback.
each ( string $attribute, string | array $rules ) Define a set of rules that apply to each element in an array attribute.
errors ( ) : MessageBag An alternative more semantic shortcut to the message container.
failed ( ) : array Get the failed validation rules.
fails ( ) : boolean Determine if the data fails the validation rules.
getCustomAttributes ( ) : array Get the custom attributes used by the validator.
getCustomMessages ( ) : array Get the custom messages for the validator.
getCustomValues ( ) : array Get the custom values for the validator.
getData ( ) : array Get the data under validation.
getDisplayableValue ( string $attribute, mixed $value ) : string Get the displayable name of the value.
getExtensions ( ) : array Get the array of custom validator extensions.
getFallbackMessages ( ) : array Get the fallback messages for the validator.
getFiles ( ) : array Get the files under validation.
getPresenceVerifier ( ) : Overtrue\Validation\PresenceVerifierInterface Get the Presence Verifier implementation.
getReplacers ( ) : array Get the array of custom validator message replacers.
getRules ( ) : array Get the validation rules.
getTranslator ( ) : Overtrue\Validation\TranslatorInterface Get the Translator implementation.
mergeRules ( string $attribute, string | array $rules ) Merge additional rules into a given attribute.
messages ( ) : MessageBag Get the message container for the validator.
passes ( ) : boolean Determine if the data passes the validation rules.
setAttributeNames ( array $attributes ) Set the custom attributes on the validator.
setCustomMessages ( array $messages ) Set the custom messages for the validator.
setData ( array $data ) Set the data under validation.
setFallbackMessages ( array $messages ) Set the fallback messages for the validator.
setFiles ( array $files ) Set the files under validation.
setPresenceVerifier ( Overtrue\Validation\PresenceVerifierInterface $presenceVerifier ) Set the Presence Verifier implementation.
setRules ( array $rules ) Set the validation rules.
setTranslator ( Overtrue\Validation\TranslatorInterface $translator ) Set the Translator implementation.
setValueNames ( array $values ) Set the custom values on the validator.
sometimes ( string $attribute, string | array $rules, callable $callback ) Add conditions to a given field based on a Closure.

Защищенные методы

Метод Описание
addError ( string $attribute, string $rule, array $parameters ) Add an error message to the validator's collection of messages.
addFailure ( string $attribute, string $rule, array $parameters ) Add a failed rule and error message to the collection.
allFailingRequired ( array $attributes ) : boolean Determine if all of the given attributes fail the required test.
anyFailingRequired ( array $attributes ) : boolean Determine if any of the given attributes fail the required test.
callClassBasedExtension ( string $callback, array $parameters ) : boolean Call a class based validator extension.
callClassBasedReplacer ( string $callback, string $message, string $attribute, string $rule, array $parameters ) : string Call a class based validator message replacer.
callExtension ( string $rule, array $parameters ) : boolean Call a custom validator extension.
callReplacer ( string $message, string $attribute, string $rule, array $parameters ) : string Call a custom validator message replacer.
checkDateTimeOrder ( string $format, string $before, string $after ) : boolean Given two date/time strings, check that one is after the other.
doReplacements ( string $message, string $attribute, string $rule, array $parameters ) : string Replace all error message place-holders with actual values.
explodeRules ( string | array $rules ) : array Explode the rules into an array of rules.
getAttribute ( string $attribute ) : string Get the displayable name of the attribute.
getAttributeList ( array $values ) : array Transform an array of attributes to their displayable form.
getAttributeType ( string $attribute ) : string Get the data type of the given attribute.
getDateFormat ( string $attribute ) : string | null Get the date format for an attribute if it has one.
getDateTimeWithOptionalFormat ( string $format, string $value ) : DateTime | null Get a DateTime instance from a string.
getExistCount ( string $table, string $column, mixed $value, array $parameters ) : integer Get the number of records that exist in storage.
getExtraConditions ( array $segments ) : array Get the extra conditions for a unique / exists rule.
getExtraExistConditions ( array $parameters ) : array Get the extra exist conditions.
getInlineMessage ( string $attribute, string $lowerRule, array $source = null ) : string Get the inline message for a rule if it exists.
getMessage ( string $attribute, string $rule ) : string Get the validation message for an attribute and rule.
getPresentCount ( array $attributes ) : integer Get the number of attributes in a list that are present.
getRule ( string $attribute, string | array $rules ) : array | null Get a rule and its parameters for a given attribute.
getSize ( string $attribute, mixed $value ) : mixed Get the size of an attribute.
getSizeMessage ( string $attribute, string $rule ) : string Get the proper error message for an attribute and size rule.
getStringSize ( string $value ) : integer Get the size of a string.
getUniqueExtra ( array $parameters ) : array Get the extra conditions for a unique rule.
getUniqueIds ( array $parameters ) : array Get the excluded ID column and value for the unique rule.
getValue ( string $attribute ) : mixed Get the value of a given attribute.
hasRule ( string $attribute, string | array $rules ) : boolean Determine if the given attribute has a rule in the given set.
isImplicit ( string $rule ) : boolean Determine if a given rule implies the attribute is required.
isValidatable ( string $rule, string $attribute, mixed $value ) : boolean Determine if the attribute is validatable.
parseArrayRule ( array $rules ) : array Parse an array based rule.
parseData ( array $data ) : array Parse the data and hydrate the files array.
parseParameters ( string $rule, string $parameter ) : array Parse a parameter list.
parseRule ( array | string $rules ) : array Extract the rule name and parameters from a rule.
parseStringRule ( string $rules ) : array Parse a string based rule.
passesOptionalCheck ( string $attribute ) : boolean Determine if the attribute passes any optional check.
presentOrRuleIsImplicit ( string $rule, string $attribute, mixed $value ) : boolean Determine if the field is present, or the rule implies required.
replaceAfter ( string $message, string $attribute, string $rule, array $parameters ) : string Replace all place-holders for the after rule.
replaceBefore ( string $message, string $attribute, string $rule, array $parameters ) : string Replace all place-holders for the before rule.
replaceBetween ( string $message, string $attribute, string $rule, array $parameters ) : string Replace all place-holders for the between rule.
replaceDateFormat ( string $message, string $attribute, string $rule, array $parameters ) : string Replace all place-holders for the date_format rule.
replaceDifferent ( string $message, string $attribute, string $rule, array $parameters ) : string Replace all place-holders for the different rule.
replaceDigits ( string $message, string $attribute, string $rule, array $parameters ) : string Replace all place-holders for the digits rule.
replaceDigitsBetween ( string $message, string $attribute, string $rule, array $parameters ) : string Replace all place-holders for the digits (between) rule.
replaceIn ( string $message, string $attribute, string $rule, array $parameters ) : string Replace all place-holders for the in rule.
replaceMax ( string $message, string $attribute, string $rule, array $parameters ) : string Replace all place-holders for the max rule.
replaceMimes ( string $message, string $attribute, string $rule, array $parameters ) : string Replace all place-holders for the mimes rule.
replaceMin ( string $message, string $attribute, string $rule, array $parameters ) : string Replace all place-holders for the min rule.
replaceNotIn ( string $message, string $attribute, string $rule, array $parameters ) : string Replace all place-holders for the not_in rule.
replaceRequiredIf ( string $message, string $attribute, string $rule, array $parameters ) : string Replace all place-holders for the required_if rule.
replaceRequiredWith ( string $message, string $attribute, string $rule, array $parameters ) : string Replace all place-holders for the required_with rule.
replaceRequiredWithAll ( string $message, string $attribute, string $rule, array $parameters ) : string Replace all place-holders for the required_with_all rule.
replaceRequiredWithout ( string $message, string $attribute, string $rule, array $parameters ) : string Replace all place-holders for the required_without rule.
replaceRequiredWithoutAll ( string $message, string $attribute, string $rule, array $parameters ) : string Replace all place-holders for the required_without_all rule.
replaceSame ( string $message, string $attribute, string $rule, array $parameters ) : string Replace all place-holders for the same rule.
replaceSize ( string $message, string $attribute, string $rule, array $parameters ) : string Replace all place-holders for the size rule.
requireParameterCount ( integer $count, array $parameters, string $rule ) Require a certain number of parameters to be present.
validate ( string $attribute, string $rule ) Validate a given attribute against a rule.
validateAccepted ( string $attribute, mixed $value ) : boolean Validate that an attribute was "accepted".
validateActiveUrl ( string $attribute, mixed $value ) : boolean Validate that an attribute is an active URL.
validateAfter ( string $attribute, mixed $value, array $parameters ) : boolean Validate the date is after a given date.
validateAfterWithFormat ( string $format, mixed $value, array $parameters ) : boolean Validate the date is after a given date with a given format.
validateAlpha ( string $attribute, mixed $value ) : boolean Validate that an attribute contains only alphabetic characters.
validateAlphaDash ( string $attribute, mixed $value ) : boolean Validate that an attribute contains only alpha-numeric characters, dashes, and underscores.
validateAlphaNum ( string $attribute, mixed $value ) : boolean Validate that an attribute contains only alpha-numeric characters.
validateArray ( string $attribute, mixed $value ) : boolean Validate that an attribute is an array.
validateBefore ( string $attribute, mixed $value, array $parameters ) : boolean Validate the date is before a given date.
validateBeforeWithFormat ( string $format, mixed $value, array $parameters ) : boolean Validate the date is before a given date with a given format.
validateBetween ( string $attribute, mixed $value, array $parameters ) : boolean Validate the size of an attribute is between a set of values.
validateBoolean ( string $attribute, mixed $value ) : boolean Validate that an attribute is a boolean.
validateConfirmed ( string $attribute, mixed $value ) : boolean Validate that an attribute has a matching confirmation.
validateDate ( string $attribute, mixed $value ) : boolean Validate that an attribute is a valid date.
validateDateFormat ( string $attribute, mixed $value, array $parameters ) : boolean Validate that an attribute matches a date format.
validateDifferent ( string $attribute, mixed $value, array $parameters ) : boolean Validate that an attribute is different from another attribute.
validateDigits ( string $attribute, mixed $value, array $parameters ) : boolean Validate that an attribute has a given number of digits.
validateDigitsBetween ( string $attribute, mixed $value, array $parameters ) : boolean Validate that an attribute is between a given number of digits.
validateEmail ( string $attribute, mixed $value ) : boolean Validate that an attribute is a valid e-mail address.
validateExists ( string $attribute, mixed $value, array $parameters ) : boolean Validate the existence of an attribute value in a database table.
validateFilled ( string $attribute, mixed $value ) : boolean Validate the given attribute is filled if it is present.
validateImage ( string $attribute, mixed $value ) : boolean Validate the MIME type of a file is an image MIME type.
validateIn ( string $attribute, mixed $value, array $parameters ) : boolean Validate an attribute is contained within a list of values.
validateInteger ( string $attribute, mixed $value ) : boolean Validate that an attribute is an integer.
validateIp ( string $attribute, mixed $value ) : boolean Validate that an attribute is a valid IP.
validateMax ( string $attribute, mixed $value, array $parameters ) : boolean Validate the size of an attribute is less than a maximum value.
validateMimes ( string $attribute, array $value, array $parameters ) : boolean Validate the MIME type of a file upload attribute is in a set of MIME types.
validateMin ( string $attribute, mixed $value, array $parameters ) : boolean Validate the size of an attribute is greater than a minimum value.
validateNotIn ( string $attribute, mixed $value, array $parameters ) : boolean Validate an attribute is not contained within a list of values.
validateNumeric ( string $attribute, mixed $value ) : boolean Validate that an attribute is numeric.
validateRegex ( string $attribute, mixed $value, array $parameters ) : boolean Validate that an attribute passes a regular expression check.
validateRequired ( string $attribute, mixed $value ) : boolean Validate that a required attribute exists.
validateRequiredIf ( string $attribute, mixed $value, mixed $parameters ) : boolean Validate that an attribute exists when another attribute has a given value.
validateRequiredWith ( string $attribute, mixed $value, mixed $parameters ) : boolean Validate that an attribute exists when any other attribute exists.
validateRequiredWithAll ( string $attribute, mixed $value, mixed $parameters ) : boolean Validate that an attribute exists when all other attributes exists.
validateRequiredWithout ( string $attribute, mixed $value, mixed $parameters ) : boolean Validate that an attribute exists when another attribute does not.
validateRequiredWithoutAll ( string $attribute, mixed $value, mixed $parameters ) : boolean Validate that an attribute exists when all other attributes do not.
validateSame ( string $attribute, mixed $value, array $parameters ) : boolean Validate that two attributes match.
validateSize ( string $attribute, mixed $value, array $parameters ) : boolean Validate the size of an attribute.
validateSometimes ( ) : boolean "Validate" optional attributes.
validateTimezone ( string $attribute, mixed $value ) : boolean Validate that an attribute is a valid timezone.
validateUnique ( string $attribute, mixed $value, array $parameters ) : boolean Validate the uniqueness of an attribute value on a given database table.
validateUrl ( string $attribute, mixed $value ) : boolean Validate that an attribute is a valid URL.

Описание методов

__call() публичный Метод

Handle dynamic calls to class methods.
public __call ( string $method, array $parameters ) : mixed
$method string
$parameters array
Результат mixed

__construct() публичный Метод

Create a new Validator instance.
public __construct ( Overtrue\Validation\TranslatorInterface $translator, array $data, array $rules, array $messages = [], array $customAttributes = [] ) : Validator
$translator Overtrue\Validation\TranslatorInterface
$data array
$rules array
$messages array
$customAttributes array
Результат Validator

addCustomAttributes() публичный Метод

Add custom attributes to the validator.
public addCustomAttributes ( array $customAttributes )
$customAttributes array

addCustomValues() публичный Метод

Add the custom values for the validator.
public addCustomValues ( array $customValues )
$customValues array

addError() защищенный Метод

Add an error message to the validator's collection of messages.
protected addError ( string $attribute, string $rule, array $parameters )
$attribute string
$rule string
$parameters array

addExtension() публичный Метод

Register a custom validator extension.
public addExtension ( string $rule, Closure | string $extension )
$rule string
$extension Closure | string

addExtensions() публичный Метод

Register an array of custom validator extensions.
public addExtensions ( array $extensions )
$extensions array

addFailure() защищенный Метод

Add a failed rule and error message to the collection.
protected addFailure ( string $attribute, string $rule, array $parameters )
$attribute string
$rule string
$parameters array

addImplicitExtension() публичный Метод

Register a custom implicit validator extension.
public addImplicitExtension ( string $rule, Closure | string $extension )
$rule string
$extension Closure | string

addImplicitExtensions() публичный Метод

Register an array of custom implicit validator extensions.
public addImplicitExtensions ( array $extensions )
$extensions array

addReplacer() публичный Метод

Register a custom validator message replacer.
public addReplacer ( string $rule, Closure | string $replacer )
$rule string
$replacer Closure | string

addReplacers() публичный Метод

Register an array of custom validator message replacers.
public addReplacers ( array $replacers )
$replacers array

after() публичный Метод

After an after validation callback.
public after ( callable | string $callback )
$callback callable | string

allFailingRequired() защищенный Метод

Determine if all of the given attributes fail the required test.
protected allFailingRequired ( array $attributes ) : boolean
$attributes array
Результат boolean

anyFailingRequired() защищенный Метод

Determine if any of the given attributes fail the required test.
protected anyFailingRequired ( array $attributes ) : boolean
$attributes array
Результат boolean

callClassBasedExtension() защищенный Метод

Call a class based validator extension.
protected callClassBasedExtension ( string $callback, array $parameters ) : boolean
$callback string
$parameters array
Результат boolean

callClassBasedReplacer() защищенный Метод

Call a class based validator message replacer.
protected callClassBasedReplacer ( string $callback, string $message, string $attribute, string $rule, array $parameters ) : string
$callback string
$message string
$attribute string
$rule string
$parameters array
Результат string

callExtension() защищенный Метод

Call a custom validator extension.
protected callExtension ( string $rule, array $parameters ) : boolean
$rule string
$parameters array
Результат boolean

callReplacer() защищенный Метод

Call a custom validator message replacer.
protected callReplacer ( string $message, string $attribute, string $rule, array $parameters ) : string
$message string
$attribute string
$rule string
$parameters array
Результат string

checkDateTimeOrder() защищенный Метод

Given two date/time strings, check that one is after the other.
protected checkDateTimeOrder ( string $format, string $before, string $after ) : boolean
$format string
$before string
$after string
Результат boolean

doReplacements() защищенный Метод

Replace all error message place-holders with actual values.
protected doReplacements ( string $message, string $attribute, string $rule, array $parameters ) : string
$message string
$attribute string
$rule string
$parameters array
Результат string

each() публичный Метод

Define a set of rules that apply to each element in an array attribute.
public each ( string $attribute, string | array $rules )
$attribute string
$rules string | array

errors() публичный Метод

An alternative more semantic shortcut to the message container.
public errors ( ) : MessageBag
Результат MessageBag

explodeRules() защищенный Метод

Explode the rules into an array of rules.
protected explodeRules ( string | array $rules ) : array
$rules string | array
Результат array

failed() публичный Метод

Get the failed validation rules.
public failed ( ) : array
Результат array

fails() публичный Метод

Determine if the data fails the validation rules.
public fails ( ) : boolean
Результат boolean

getAttribute() защищенный Метод

Get the displayable name of the attribute.
protected getAttribute ( string $attribute ) : string
$attribute string
Результат string

getAttributeList() защищенный Метод

Transform an array of attributes to their displayable form.
protected getAttributeList ( array $values ) : array
$values array
Результат array

getAttributeType() защищенный Метод

Get the data type of the given attribute.
protected getAttributeType ( string $attribute ) : string
$attribute string
Результат string

getCustomAttributes() публичный Метод

Get the custom attributes used by the validator.
public getCustomAttributes ( ) : array
Результат array

getCustomMessages() публичный Метод

Get the custom messages for the validator.
public getCustomMessages ( ) : array
Результат array

getCustomValues() публичный Метод

Get the custom values for the validator.
public getCustomValues ( ) : array
Результат array

getData() публичный Метод

Get the data under validation.
public getData ( ) : array
Результат array

getDateFormat() защищенный Метод

Get the date format for an attribute if it has one.
protected getDateFormat ( string $attribute ) : string | null
$attribute string
Результат string | null

getDateTimeWithOptionalFormat() защищенный Метод

Get a DateTime instance from a string.
protected getDateTimeWithOptionalFormat ( string $format, string $value ) : DateTime | null
$format string
$value string
Результат DateTime | null

getDisplayableValue() публичный Метод

Get the displayable name of the value.
public getDisplayableValue ( string $attribute, mixed $value ) : string
$attribute string
$value mixed
Результат string

getExistCount() защищенный Метод

Get the number of records that exist in storage.
protected getExistCount ( string $table, string $column, mixed $value, array $parameters ) : integer
$table string
$column string
$value mixed
$parameters array
Результат integer

getExtensions() публичный Метод

Get the array of custom validator extensions.
public getExtensions ( ) : array
Результат array

getExtraConditions() защищенный Метод

Get the extra conditions for a unique / exists rule.
protected getExtraConditions ( array $segments ) : array
$segments array
Результат array

getExtraExistConditions() защищенный Метод

Get the extra exist conditions.
protected getExtraExistConditions ( array $parameters ) : array
$parameters array
Результат array

getFallbackMessages() публичный Метод

Get the fallback messages for the validator.
public getFallbackMessages ( ) : array
Результат array

getFiles() публичный Метод

Get the files under validation.
public getFiles ( ) : array
Результат array

getInlineMessage() защищенный Метод

Get the inline message for a rule if it exists.
protected getInlineMessage ( string $attribute, string $lowerRule, array $source = null ) : string
$attribute string
$lowerRule string
$source array
Результат string

getMessage() защищенный Метод

Get the validation message for an attribute and rule.
protected getMessage ( string $attribute, string $rule ) : string
$attribute string
$rule string
Результат string

getPresenceVerifier() публичный Метод

Get the Presence Verifier implementation.
public getPresenceVerifier ( ) : Overtrue\Validation\PresenceVerifierInterface
Результат Overtrue\Validation\PresenceVerifierInterface

getPresentCount() защищенный Метод

Get the number of attributes in a list that are present.
protected getPresentCount ( array $attributes ) : integer
$attributes array
Результат integer

getReplacers() публичный Метод

Get the array of custom validator message replacers.
public getReplacers ( ) : array
Результат array

getRule() защищенный Метод

Get a rule and its parameters for a given attribute.
protected getRule ( string $attribute, string | array $rules ) : array | null
$attribute string
$rules string | array
Результат array | null

getRules() публичный Метод

Get the validation rules.
public getRules ( ) : array
Результат array

getSize() защищенный Метод

Get the size of an attribute.
protected getSize ( string $attribute, mixed $value ) : mixed
$attribute string
$value mixed
Результат mixed

getSizeMessage() защищенный Метод

Get the proper error message for an attribute and size rule.
protected getSizeMessage ( string $attribute, string $rule ) : string
$attribute string
$rule string
Результат string

getStringSize() защищенный Метод

Get the size of a string.
protected getStringSize ( string $value ) : integer
$value string
Результат integer

getTranslator() публичный Метод

Get the Translator implementation.
public getTranslator ( ) : Overtrue\Validation\TranslatorInterface
Результат Overtrue\Validation\TranslatorInterface

getUniqueExtra() защищенный Метод

Get the extra conditions for a unique rule.
protected getUniqueExtra ( array $parameters ) : array
$parameters array
Результат array

getUniqueIds() защищенный Метод

Get the excluded ID column and value for the unique rule.
protected getUniqueIds ( array $parameters ) : array
$parameters array
Результат array

getValue() защищенный Метод

Get the value of a given attribute.
protected getValue ( string $attribute ) : mixed
$attribute string
Результат mixed

hasRule() защищенный Метод

Determine if the given attribute has a rule in the given set.
protected hasRule ( string $attribute, string | array $rules ) : boolean
$attribute string
$rules string | array
Результат boolean

isImplicit() защищенный Метод

Determine if a given rule implies the attribute is required.
protected isImplicit ( string $rule ) : boolean
$rule string
Результат boolean

isValidatable() защищенный Метод

Determine if the attribute is validatable.
protected isValidatable ( string $rule, string $attribute, mixed $value ) : boolean
$rule string
$attribute string
$value mixed
Результат boolean

mergeRules() публичный Метод

Merge additional rules into a given attribute.
public mergeRules ( string $attribute, string | array $rules )
$attribute string
$rules string | array

messages() публичный Метод

Get the message container for the validator.
public messages ( ) : MessageBag
Результат MessageBag

parseArrayRule() защищенный Метод

Parse an array based rule.
protected parseArrayRule ( array $rules ) : array
$rules array
Результат array

parseData() защищенный Метод

Parse the data and hydrate the files array.
protected parseData ( array $data ) : array
$data array
Результат array

parseParameters() защищенный Метод

Parse a parameter list.
protected parseParameters ( string $rule, string $parameter ) : array
$rule string
$parameter string
Результат array

parseRule() защищенный Метод

Extract the rule name and parameters from a rule.
protected parseRule ( array | string $rules ) : array
$rules array | string
Результат array

parseStringRule() защищенный Метод

Parse a string based rule.
protected parseStringRule ( string $rules ) : array
$rules string
Результат array

passes() публичный Метод

Determine if the data passes the validation rules.
public passes ( ) : boolean
Результат boolean

passesOptionalCheck() защищенный Метод

Determine if the attribute passes any optional check.
protected passesOptionalCheck ( string $attribute ) : boolean
$attribute string
Результат boolean

presentOrRuleIsImplicit() защищенный Метод

Determine if the field is present, or the rule implies required.
protected presentOrRuleIsImplicit ( string $rule, string $attribute, mixed $value ) : boolean
$rule string
$attribute string
$value mixed
Результат boolean

replaceAfter() защищенный Метод

Replace all place-holders for the after rule.
protected replaceAfter ( string $message, string $attribute, string $rule, array $parameters ) : string
$message string
$attribute string
$rule string
$parameters array
Результат string

replaceBefore() защищенный Метод

Replace all place-holders for the before rule.
protected replaceBefore ( string $message, string $attribute, string $rule, array $parameters ) : string
$message string
$attribute string
$rule string
$parameters array
Результат string

replaceBetween() защищенный Метод

Replace all place-holders for the between rule.
protected replaceBetween ( string $message, string $attribute, string $rule, array $parameters ) : string
$message string
$attribute string
$rule string
$parameters array
Результат string

replaceDateFormat() защищенный Метод

Replace all place-holders for the date_format rule.
protected replaceDateFormat ( string $message, string $attribute, string $rule, array $parameters ) : string
$message string
$attribute string
$rule string
$parameters array
Результат string

replaceDifferent() защищенный Метод

Replace all place-holders for the different rule.
protected replaceDifferent ( string $message, string $attribute, string $rule, array $parameters ) : string
$message string
$attribute string
$rule string
$parameters array
Результат string

replaceDigits() защищенный Метод

Replace all place-holders for the digits rule.
protected replaceDigits ( string $message, string $attribute, string $rule, array $parameters ) : string
$message string
$attribute string
$rule string
$parameters array
Результат string

replaceDigitsBetween() защищенный Метод

Replace all place-holders for the digits (between) rule.
protected replaceDigitsBetween ( string $message, string $attribute, string $rule, array $parameters ) : string
$message string
$attribute string
$rule string
$parameters array
Результат string

replaceIn() защищенный Метод

Replace all place-holders for the in rule.
protected replaceIn ( string $message, string $attribute, string $rule, array $parameters ) : string
$message string
$attribute string
$rule string
$parameters array
Результат string

replaceMax() защищенный Метод

Replace all place-holders for the max rule.
protected replaceMax ( string $message, string $attribute, string $rule, array $parameters ) : string
$message string
$attribute string
$rule string
$parameters array
Результат string

replaceMimes() защищенный Метод

Replace all place-holders for the mimes rule.
protected replaceMimes ( string $message, string $attribute, string $rule, array $parameters ) : string
$message string
$attribute string
$rule string
$parameters array
Результат string

replaceMin() защищенный Метод

Replace all place-holders for the min rule.
protected replaceMin ( string $message, string $attribute, string $rule, array $parameters ) : string
$message string
$attribute string
$rule string
$parameters array
Результат string

replaceNotIn() защищенный Метод

Replace all place-holders for the not_in rule.
protected replaceNotIn ( string $message, string $attribute, string $rule, array $parameters ) : string
$message string
$attribute string
$rule string
$parameters array
Результат string

replaceRequiredIf() защищенный Метод

Replace all place-holders for the required_if rule.
protected replaceRequiredIf ( string $message, string $attribute, string $rule, array $parameters ) : string
$message string
$attribute string
$rule string
$parameters array
Результат string

replaceRequiredWith() защищенный Метод

Replace all place-holders for the required_with rule.
protected replaceRequiredWith ( string $message, string $attribute, string $rule, array $parameters ) : string
$message string
$attribute string
$rule string
$parameters array
Результат string

replaceRequiredWithAll() защищенный Метод

Replace all place-holders for the required_with_all rule.
protected replaceRequiredWithAll ( string $message, string $attribute, string $rule, array $parameters ) : string
$message string
$attribute string
$rule string
$parameters array
Результат string

replaceRequiredWithout() защищенный Метод

Replace all place-holders for the required_without rule.
protected replaceRequiredWithout ( string $message, string $attribute, string $rule, array $parameters ) : string
$message string
$attribute string
$rule string
$parameters array
Результат string

replaceRequiredWithoutAll() защищенный Метод

Replace all place-holders for the required_without_all rule.
protected replaceRequiredWithoutAll ( string $message, string $attribute, string $rule, array $parameters ) : string
$message string
$attribute string
$rule string
$parameters array
Результат string

replaceSame() защищенный Метод

Replace all place-holders for the same rule.
protected replaceSame ( string $message, string $attribute, string $rule, array $parameters ) : string
$message string
$attribute string
$rule string
$parameters array
Результат string

replaceSize() защищенный Метод

Replace all place-holders for the size rule.
protected replaceSize ( string $message, string $attribute, string $rule, array $parameters ) : string
$message string
$attribute string
$rule string
$parameters array
Результат string

requireParameterCount() защищенный Метод

Require a certain number of parameters to be present.
protected requireParameterCount ( integer $count, array $parameters, string $rule )
$count integer
$parameters array
$rule string

setAttributeNames() публичный Метод

Set the custom attributes on the validator.
public setAttributeNames ( array $attributes )
$attributes array

setCustomMessages() публичный Метод

Set the custom messages for the validator.
public setCustomMessages ( array $messages )
$messages array

setData() публичный Метод

Set the data under validation.
public setData ( array $data )
$data array

setFallbackMessages() публичный Метод

Set the fallback messages for the validator.
public setFallbackMessages ( array $messages )
$messages array

setFiles() публичный Метод

Set the files under validation.
public setFiles ( array $files )
$files array

setPresenceVerifier() публичный Метод

Set the Presence Verifier implementation.
public setPresenceVerifier ( Overtrue\Validation\PresenceVerifierInterface $presenceVerifier )
$presenceVerifier Overtrue\Validation\PresenceVerifierInterface

setRules() публичный Метод

Set the validation rules.
public setRules ( array $rules )
$rules array

setTranslator() публичный Метод

Set the Translator implementation.
public setTranslator ( Overtrue\Validation\TranslatorInterface $translator )
$translator Overtrue\Validation\TranslatorInterface

setValueNames() публичный Метод

Set the custom values on the validator.
public setValueNames ( array $values )
$values array

sometimes() публичный Метод

Add conditions to a given field based on a Closure.
public sometimes ( string $attribute, string | array $rules, callable $callback )
$attribute string
$rules string | array
$callback callable

validate() защищенный Метод

Validate a given attribute against a rule.
protected validate ( string $attribute, string $rule )
$attribute string
$rule string

validateAccepted() защищенный Метод

This validation rule implies the attribute is "required".
protected validateAccepted ( string $attribute, mixed $value ) : boolean
$attribute string
$value mixed
Результат boolean

validateActiveUrl() защищенный Метод

Validate that an attribute is an active URL.
protected validateActiveUrl ( string $attribute, mixed $value ) : boolean
$attribute string
$value mixed
Результат boolean

validateAfter() защищенный Метод

Validate the date is after a given date.
protected validateAfter ( string $attribute, mixed $value, array $parameters ) : boolean
$attribute string
$value mixed
$parameters array
Результат boolean

validateAfterWithFormat() защищенный Метод

Validate the date is after a given date with a given format.
protected validateAfterWithFormat ( string $format, mixed $value, array $parameters ) : boolean
$format string
$value mixed
$parameters array
Результат boolean

validateAlpha() защищенный Метод

Validate that an attribute contains only alphabetic characters.
protected validateAlpha ( string $attribute, mixed $value ) : boolean
$attribute string
$value mixed
Результат boolean

validateAlphaDash() защищенный Метод

Validate that an attribute contains only alpha-numeric characters, dashes, and underscores.
protected validateAlphaDash ( string $attribute, mixed $value ) : boolean
$attribute string
$value mixed
Результат boolean

validateAlphaNum() защищенный Метод

Validate that an attribute contains only alpha-numeric characters.
protected validateAlphaNum ( string $attribute, mixed $value ) : boolean
$attribute string
$value mixed
Результат boolean

validateArray() защищенный Метод

Validate that an attribute is an array.
protected validateArray ( string $attribute, mixed $value ) : boolean
$attribute string
$value mixed
Результат boolean

validateBefore() защищенный Метод

Validate the date is before a given date.
protected validateBefore ( string $attribute, mixed $value, array $parameters ) : boolean
$attribute string
$value mixed
$parameters array
Результат boolean

validateBeforeWithFormat() защищенный Метод

Validate the date is before a given date with a given format.
protected validateBeforeWithFormat ( string $format, mixed $value, array $parameters ) : boolean
$format string
$value mixed
$parameters array
Результат boolean

validateBetween() защищенный Метод

Validate the size of an attribute is between a set of values.
protected validateBetween ( string $attribute, mixed $value, array $parameters ) : boolean
$attribute string
$value mixed
$parameters array
Результат boolean

validateBoolean() защищенный Метод

Validate that an attribute is a boolean.
protected validateBoolean ( string $attribute, mixed $value ) : boolean
$attribute string
$value mixed
Результат boolean

validateConfirmed() защищенный Метод

Validate that an attribute has a matching confirmation.
protected validateConfirmed ( string $attribute, mixed $value ) : boolean
$attribute string
$value mixed
Результат boolean

validateDate() защищенный Метод

Validate that an attribute is a valid date.
protected validateDate ( string $attribute, mixed $value ) : boolean
$attribute string
$value mixed
Результат boolean

validateDateFormat() защищенный Метод

Validate that an attribute matches a date format.
protected validateDateFormat ( string $attribute, mixed $value, array $parameters ) : boolean
$attribute string
$value mixed
$parameters array
Результат boolean

validateDifferent() защищенный Метод

Validate that an attribute is different from another attribute.
protected validateDifferent ( string $attribute, mixed $value, array $parameters ) : boolean
$attribute string
$value mixed
$parameters array
Результат boolean

validateDigits() защищенный Метод

Validate that an attribute has a given number of digits.
protected validateDigits ( string $attribute, mixed $value, array $parameters ) : boolean
$attribute string
$value mixed
$parameters array
Результат boolean

validateDigitsBetween() защищенный Метод

Validate that an attribute is between a given number of digits.
protected validateDigitsBetween ( string $attribute, mixed $value, array $parameters ) : boolean
$attribute string
$value mixed
$parameters array
Результат boolean

validateEmail() защищенный Метод

Validate that an attribute is a valid e-mail address.
protected validateEmail ( string $attribute, mixed $value ) : boolean
$attribute string
$value mixed
Результат boolean

validateExists() защищенный Метод

Validate the existence of an attribute value in a database table.
protected validateExists ( string $attribute, mixed $value, array $parameters ) : boolean
$attribute string
$value mixed
$parameters array
Результат boolean

validateFilled() защищенный Метод

Validate the given attribute is filled if it is present.
protected validateFilled ( string $attribute, mixed $value ) : boolean
$attribute string
$value mixed
Результат boolean

validateImage() защищенный Метод

Validate the MIME type of a file is an image MIME type.
protected validateImage ( string $attribute, mixed $value ) : boolean
$attribute string
$value mixed
Результат boolean

validateIn() защищенный Метод

Validate an attribute is contained within a list of values.
protected validateIn ( string $attribute, mixed $value, array $parameters ) : boolean
$attribute string
$value mixed
$parameters array
Результат boolean

validateInteger() защищенный Метод

Validate that an attribute is an integer.
protected validateInteger ( string $attribute, mixed $value ) : boolean
$attribute string
$value mixed
Результат boolean

validateIp() защищенный Метод

Validate that an attribute is a valid IP.
protected validateIp ( string $attribute, mixed $value ) : boolean
$attribute string
$value mixed
Результат boolean

validateMax() защищенный Метод

Validate the size of an attribute is less than a maximum value.
protected validateMax ( string $attribute, mixed $value, array $parameters ) : boolean
$attribute string
$value mixed
$parameters array
Результат boolean

validateMimes() защищенный Метод

Validate the MIME type of a file upload attribute is in a set of MIME types.
protected validateMimes ( string $attribute, array $value, array $parameters ) : boolean
$attribute string
$value array
$parameters array
Результат boolean

validateMin() защищенный Метод

Validate the size of an attribute is greater than a minimum value.
protected validateMin ( string $attribute, mixed $value, array $parameters ) : boolean
$attribute string
$value mixed
$parameters array
Результат boolean

validateNotIn() защищенный Метод

Validate an attribute is not contained within a list of values.
protected validateNotIn ( string $attribute, mixed $value, array $parameters ) : boolean
$attribute string
$value mixed
$parameters array
Результат boolean

validateNumeric() защищенный Метод

Validate that an attribute is numeric.
protected validateNumeric ( string $attribute, mixed $value ) : boolean
$attribute string
$value mixed
Результат boolean

validateRegex() защищенный Метод

Validate that an attribute passes a regular expression check.
protected validateRegex ( string $attribute, mixed $value, array $parameters ) : boolean
$attribute string
$value mixed
$parameters array
Результат boolean

validateRequired() защищенный Метод

Validate that a required attribute exists.
protected validateRequired ( string $attribute, mixed $value ) : boolean
$attribute string
$value mixed
Результат boolean

validateRequiredIf() защищенный Метод

Validate that an attribute exists when another attribute has a given value.
protected validateRequiredIf ( string $attribute, mixed $value, mixed $parameters ) : boolean
$attribute string
$value mixed
$parameters mixed
Результат boolean

validateRequiredWith() защищенный Метод

Validate that an attribute exists when any other attribute exists.
protected validateRequiredWith ( string $attribute, mixed $value, mixed $parameters ) : boolean
$attribute string
$value mixed
$parameters mixed
Результат boolean

validateRequiredWithAll() защищенный Метод

Validate that an attribute exists when all other attributes exists.
protected validateRequiredWithAll ( string $attribute, mixed $value, mixed $parameters ) : boolean
$attribute string
$value mixed
$parameters mixed
Результат boolean

validateRequiredWithout() защищенный Метод

Validate that an attribute exists when another attribute does not.
protected validateRequiredWithout ( string $attribute, mixed $value, mixed $parameters ) : boolean
$attribute string
$value mixed
$parameters mixed
Результат boolean

validateRequiredWithoutAll() защищенный Метод

Validate that an attribute exists when all other attributes do not.
protected validateRequiredWithoutAll ( string $attribute, mixed $value, mixed $parameters ) : boolean
$attribute string
$value mixed
$parameters mixed
Результат boolean

validateSame() защищенный Метод

Validate that two attributes match.
protected validateSame ( string $attribute, mixed $value, array $parameters ) : boolean
$attribute string
$value mixed
$parameters array
Результат boolean

validateSize() защищенный Метод

Validate the size of an attribute.
protected validateSize ( string $attribute, mixed $value, array $parameters ) : boolean
$attribute string
$value mixed
$parameters array
Результат boolean

validateSometimes() защищенный Метод

Always returns true, just lets us put sometimes in rules.
protected validateSometimes ( ) : boolean
Результат boolean

validateTimezone() защищенный Метод

Validate that an attribute is a valid timezone.
protected validateTimezone ( string $attribute, mixed $value ) : boolean
$attribute string
$value mixed
Результат boolean

validateUnique() защищенный Метод

If a database column is not specified, the attribute will be used.
protected validateUnique ( string $attribute, mixed $value, array $parameters ) : boolean
$attribute string
$value mixed
$parameters array
Результат boolean

validateUrl() защищенный Метод

Validate that an attribute is a valid URL.
protected validateUrl ( string $attribute, mixed $value ) : boolean
$attribute string
$value mixed
Результат boolean

Описание свойств

$after защищенное свойство

All of the registered "after" callbacks.
protected array $after
Результат array

$customAttributes защищенное свойство

The array of custom attribute names.
protected array $customAttributes
Результат array

$customMessages защищенное свойство

The array of custom error messages.
protected array $customMessages
Результат array

$customValues защищенное свойство

The array of custom displayabled values.
protected array $customValues
Результат array

$data защищенное свойство

The data under validation.
protected array $data
Результат array

$extensions защищенное свойство

All of the custom validator extensions.
protected array $extensions
Результат array

$failedRules защищенное свойство

The failed validation rules.
protected array $failedRules
Результат array

$fallbackMessages защищенное свойство

The array of fallback error messages.
protected array $fallbackMessages
Результат array

$files защищенное свойство

The files under validation.
protected array $files
Результат array

$implicitRules защищенное свойство

The validation rules that imply the field is required.
protected array $implicitRules
Результат array

$messages защищенное свойство

The messages.
protected MessageBag,Overtrue\Validation $messages
Результат MessageBag

$numericRules защищенное свойство

The numeric related validation rules.
protected array $numericRules
Результат array

$presenceVerifier защищенное свойство

The Presence Verifier implementation.
protected PresenceVerifierInterface,Overtrue\Validation $presenceVerifier
Результат Overtrue\Validation\PresenceVerifierInterface

$replacers защищенное свойство

All of the custom replacer extensions.
protected array $replacers
Результат array

$rules защищенное свойство

The rules to be applied to the data.
protected array $rules
Результат array

$sizeRules защищенное свойство

The size related validation rules.
protected array $sizeRules
Результат array

$translator защищенное свойство

The Translator implementation.
protected TranslatorInterface,Overtrue\Validation $translator
Результат Overtrue\Validation\TranslatorInterface