Validator
class Validator implements Validator (View source)
Properties
protected TranslatorInterface | $translator | The Translator implementation. | |
protected PresenceVerifierInterface | $presenceVerifier | The Presence Verifier implementation. | |
protected Container | $container | The container instance. | |
protected array | $failedRules | The failed validation rules. | |
protected MessageBag | $messages | The message bag instance. | |
protected array | $data | The data under validation. | |
protected array | $files | The files under validation. | |
protected array | $initialRules | The initial rules provided. | |
protected array | $rules | The rules to be applied to the data. | |
protected array | $implicitAttributes | The array of wildcard attributes with their asterisks expanded. | |
protected array | $after | All of the registered "after" callbacks. | |
protected array | $customMessages | The array of custom error messages. | |
protected array | $fallbackMessages | The array of fallback error messages. | |
protected array | $customAttributes | The array of custom attribute names. | |
protected array | $customValues | The array of custom displayable values. | |
protected array | $extensions | All of the custom validator extensions. | |
protected array | $replacers | All of the custom replacer extensions. | |
protected array | $sizeRules | The size related validation rules. | |
protected array | $numericRules | The numeric related validation rules. | |
protected array | $implicitRules | The validation rules that imply the field is required. | |
protected array | $dependentRules | The validation rules which depend on other fields as parameters. |
Methods
Create a new Validator instance.
Parse the data array.
Hydrate the files array.
Explode the rules into an array of rules.
After an after validation callback.
Add conditions to a given field based on a Closure.
Define a set of rules that apply to each element in an array attribute.
Gather a copy of the attribute data filled with any missing attributes.
Get all of the exact attribute values for a given wildcard attribute.
Merge additional rules into a given attribute(s).
Merge additional rules into a given attribute.
Determine if the data passes the validation rules.
Determine if the data fails the validation rules.
Run the validator's rules against its data.
Validate a given attribute against a rule.
Returns the data which was valid.
Returns the data which was invalid.
Get the value of a given attribute.
Determine if the attribute is validatable.
Determine if the field is present, or the rule implies required.
Determine if the attribute passes any optional check.
Determine if the attribute fails the nullable check.
Determine if a given rule implies the attribute is required.
Determine if it's a necessary presence validation.
Add a failed rule and error message to the collection.
Add an error message to the validator's collection of messages.
"Validate" optional attributes.
"Indicate" validation should pass if value is null.
"Break" on first validation fail.
Stop on error if "bail" rule is assigned and attribute has a message.
Validate that a required attribute exists.
Validate that an attribute exists even if not filled.
Validate the given attribute is filled if it is present.
Determine if any of the given attributes fail the required test.
Determine if all of the given attributes fail the required test.
Validate that an attribute exists when any other attribute exists.
Validate that an attribute exists when all other attributes exists.
Validate that an attribute exists when another attribute does not.
Validate that an attribute exists when all other attributes do not.
Validate that an attribute exists when another attribute has a given value.
Validate that an attribute exists when another attribute does not have a given value.
Get the number of attributes in a list that are present.
Validate that the values of an attribute is in another attribute.
Validate that an attribute has a matching confirmation.
Validate that two attributes match.
Validate that an attribute is different from another attribute.
Validate that an attribute was "accepted".
Validate that an attribute is an array.
Validate that an attribute is a boolean.
Validate that an attribute is an integer.
Validate that an attribute is numeric.
Validate that an attribute is a string.
Validate the attribute is a valid JSON string.
Validate that an attribute has a given number of digits.
Validate that an attribute is between a given number of digits.
Validate the size of an attribute.
Validate the size of an attribute is between a set of values.
Validate the size of an attribute is greater than a minimum value.
Validate the size of an attribute is less than a maximum value.
Get the size of an attribute.
Validate an attribute is contained within a list of values.
Validate an attribute is not contained within a list of values.
Validate an attribute is unique among other values.
Validate the uniqueness of an attribute value on a given database table.
Parse the connection / table for the unique / exists rules.
Get the excluded ID column and value for the unique rule.
Get the extra conditions for a unique rule.
Validate the existence of an attribute value in a database table.
Get the number of records that exist in storage.
Get the extra exist conditions.
Get the extra conditions for a unique / exists rule.
Guess the database column from the given attribute name.
Validate that an attribute is a valid IP.
Validate that an attribute is a valid e-mail address.
Validate that an attribute is a valid URL.
Validate that an attribute is an active URL.
Validate the given value is a valid file.
Validate the MIME type of a file is an image MIME type.
Validate the dimensions of an image matches the given values.
Validate the guessed extension of a file upload is in a set of file extensions.
Validate the MIME type of a file upload attribute is in a set of MIME types.
Check that the given value is a valid file instance.
Validate that an attribute contains only alphabetic characters.
Validate that an attribute contains only alpha-numeric characters.
Validate that an attribute contains only alpha-numeric characters, dashes, and underscores.
Validate that an attribute passes a regular expression check.
Validate that an attribute is a valid date.
Validate that an attribute matches a date format.
Validate the date is before a given date.
Validate the date is before a given date with a given format.
Validate the date is after a given date.
Validate the date is after a given date with a given format.
Given two date/time strings, check that one is after the other.
Get a DateTime instance from a string.
Validate that an attribute is a valid timezone.
Get the date format for an attribute if it has one.
Get the date timestamp.
Get the validation message for an attribute and rule.
Get the inline message for a rule if it exists.
Get the custom error message from translator.
Get the proper error message for an attribute and size rule.
Get the data type of the given attribute.
Replace all error message place-holders with actual values.
Transform an array of attributes to their displayable form.
Get the displayable name of the attribute.
Get the primary attribute name.
Get the displayable name of the value.
Replace all place-holders for the between rule.
Replace all place-holders for the date_format rule.
Replace all place-holders for the different rule.
Replace all place-holders for the digits rule.
Replace all place-holders for the digits (between) rule.
Replace all place-holders for the min rule.
Replace all place-holders for the max rule.
Replace all place-holders for the in rule.
Replace all place-holders for the not_in rule.
Replace all place-holders for the in_array rule.
Replace all place-holders for the mimes rule.
Replace all place-holders for the required_with rule.
Replace all place-holders for the required_with_all rule.
Replace all place-holders for the required_without rule.
Replace all place-holders for the required_without_all rule.
Replace all place-holders for the size rule.
Replace all place-holders for the required_if rule.
Replace all place-holders for the required_unless rule.
Replace all place-holders for the same rule.
Replace all place-holders for the before rule.
Replace all place-holders for the after rule.
Get all attributes.
Checks if an attribute exists.
Determine if the given attribute has a rule in the given set.
Get a rule and its parameters for a given attribute.
Extract the rule name and parameters from a rule.
Parse an array based rule.
Parse a string based rule.
Parse a parameter list.
Parse named parameters to $key => $value items.
Normalizes a rule so that we can accept short types.
Determine if the given rule depends on other fields.
Get the explicit keys from an attribute flattened with dot notation.
Get the explicit part of the attribute name.
Extract data based on the given dot-notated path.
Replace each field parameter which has asterisks with the given keys.
Replace asterisks with explicit keys.
Get the array of custom validator extensions.
Register an array of custom validator extensions.
Register an array of custom implicit validator extensions.
Register a custom implicit validator extension.
Get the array of custom validator message replacers.
Register an array of custom validator message replacers.
Get the data under validation.
Set the data under validation.
Get the validation rules.
Set the validation rules.
Set the custom attributes on the validator.
Set the custom values on the validator.
Get the files under validation.
Set the files under validation.
Get the Presence Verifier implementation.
Set the Presence Verifier implementation.
Get the Translator implementation.
Set the Translator implementation.
Get the custom messages for the validator.
Set the custom messages for the validator.
Get the custom attributes used by the validator.
Add custom attributes to the validator.
Get the custom values for the validator.
Add the custom values for the validator.
Get the fallback messages for the validator.
Set the fallback messages for the validator.
Get the failed validation rules.
Get the message container for the validator.
An alternative more semantic shortcut to the message container.
Get the messages for the instance.
Call a custom validator extension.
Call a class based validator extension.
Call a custom validator message replacer.
Call a class based validator message replacer.
Require a certain number of parameters to be present.
Handle dynamic calls to class methods.
Details
at line 190
void
__construct(TranslatorInterface $translator, array $data, array $rules, array $messages = [], array $customAttributes = [])
Create a new Validator instance.
at line 207
array
parseData(array $data)
Parse the data array.
at line 233
protected array
hydrateFiles(array $data, string $arrayKey = null)
Hydrate the files array.
at line 263
protected array
explodeRules(string|array $rules)
Explode the rules into an array of rules.
at line 284
$this
after(callable|string $callback)
After an after validation callback.
at line 301
void
sometimes(string $attribute, string|array $rules, callable $callback)
Add conditions to a given field based on a Closure.
at line 325
void
each(string $attribute, string|array $rules)
Define a set of rules that apply to each element in an array attribute.
at line 354
protected array
initializeAttributeOnData(string $attribute)
Gather a copy of the attribute data filled with any missing attributes.
at line 374
array
extractValuesForWildcards(array $data, string $attribute)
Get all of the exact attribute values for a given wildcard attribute.
at line 404
$this
mergeRules(string $attribute, string|array $rules = [])
Merge additional rules into a given attribute(s).
at line 424
protected $this
mergeRulesForAttribute(string $attribute, string|array $rules)
Merge additional rules into a given attribute.
at line 440
bool
passes()
Determine if the data passes the validation rules.
at line 474
bool
fails()
Determine if the data fails the validation rules.
at line 486
void
validate()
Run the validator's rules against its data.
at line 500
protected void
validateAttribute(string $attribute, string $rule)
Validate a given attribute against a rule.
at line 535
array
valid()
Returns the data which was valid.
at line 549
array
invalid()
Returns the data which was invalid.
at line 564
protected mixed
getValue(string $attribute)
Get the value of a given attribute.
at line 581
protected bool
isValidatable(string $rule, string $attribute, mixed $value)
Determine if the attribute is validatable.
at line 597
protected bool
presentOrRuleIsImplicit(string $rule, string $attribute, mixed $value)
Determine if the field is present, or the rule implies required.
at line 612
protected bool
passesOptionalCheck(string $attribute)
Determine if the attribute passes any optional check.
at line 630
protected bool
isNotNullIfMarkedAsNullable(string $attribute, mixed $value)
Determine if the attribute fails the nullable check.
at line 645
protected bool
isImplicit(string $rule)
Determine if a given rule implies the attribute is required.
at line 659
protected bool
hasNotFailedPreviousRuleIfPresenceRule(string $rule, string $attribute)
Determine if it's a necessary presence validation.
This is to avoid possible database type comparison errors.
at line 673
protected void
addFailure(string $attribute, string $rule, array $parameters)
Add a failed rule and error message to the collection.
at line 688
protected void
addError(string $attribute, string $rule, array $parameters)
Add an error message to the validator's collection of messages.
at line 704
protected bool
validateSometimes()
"Validate" optional attributes.
Always returns true, just lets us put sometimes in rules.
at line 716
protected bool
validateNullable()
"Indicate" validation should pass if value is null.
Always returns true, just lets us put "nullable" in rules.
at line 728
protected bool
validateBail()
"Break" on first validation fail.
Always returns true, just lets us put "bail" in rules.
at line 739
protected bool
shouldStopValidating(string $attribute)
Stop on error if "bail" rule is assigned and attribute has a message.
at line 755
protected bool
validateRequired(string $attribute, mixed $value)
Validate that a required attribute exists.
at line 777
protected bool
validatePresent(string $attribute, mixed $value)
Validate that an attribute exists even if not filled.
at line 789
protected bool
validateFilled(string $attribute, mixed $value)
Validate the given attribute is filled if it is present.
at line 804
protected bool
anyFailingRequired(array $attributes)
Determine if any of the given attributes fail the required test.
at line 821
protected bool
allFailingRequired(array $attributes)
Determine if all of the given attributes fail the required test.
at line 840
protected bool
validateRequiredWith(string $attribute, mixed $value, mixed $parameters)
Validate that an attribute exists when any other attribute exists.
at line 857
protected bool
validateRequiredWithAll(string $attribute, mixed $value, mixed $parameters)
Validate that an attribute exists when all other attributes exists.
at line 874
protected bool
validateRequiredWithout(string $attribute, mixed $value, mixed $parameters)
Validate that an attribute exists when another attribute does not.
at line 891
protected bool
validateRequiredWithoutAll(string $attribute, mixed $value, mixed $parameters)
Validate that an attribute exists when all other attributes do not.
at line 908
protected bool
validateRequiredIf(string $attribute, mixed $value, mixed $parameters)
Validate that an attribute exists when another attribute has a given value.
at line 941
protected bool
validateRequiredUnless(string $attribute, mixed $value, mixed $parameters)
Validate that an attribute exists when another attribute does not have a given value.
at line 962
protected int
getPresentCount(array $attributes)
Get the number of attributes in a list that are present.
at line 983
protected bool
validateInArray(string $attribute, mixed $value, array $parameters)
Validate that the values of an attribute is in another attribute.
at line 1005
protected bool
validateConfirmed(string $attribute, mixed $value)
Validate that an attribute has a matching confirmation.
at line 1018
protected bool
validateSame(string $attribute, mixed $value, array $parameters)
Validate that two attributes match.
at line 1035
protected bool
validateDifferent(string $attribute, mixed $value, array $parameters)
Validate that an attribute is different from another attribute.
at line 1053
protected bool
validateAccepted(string $attribute, mixed $value)
Validate that an attribute was "accepted".
This validation rule implies the attribute is "required".
at line 1067
protected bool
validateArray(string $attribute, mixed $value)
Validate that an attribute is an array.
at line 1079
protected bool
validateBoolean(string $attribute, mixed $value)
Validate that an attribute is a boolean.
at line 1093
protected bool
validateInteger(string $attribute, mixed $value)
Validate that an attribute is an integer.
at line 1105
protected bool
validateNumeric(string $attribute, mixed $value)
Validate that an attribute is numeric.
at line 1117
protected bool
validateString(string $attribute, mixed $value)
Validate that an attribute is a string.
at line 1129
protected bool
validateJson(string $attribute, mixed $value)
Validate the attribute is a valid JSON string.
at line 1148
protected bool
validateDigits(string $attribute, mixed $value, array $parameters)
Validate that an attribute has a given number of digits.
at line 1164
protected bool
validateDigitsBetween(string $attribute, mixed $value, array $parameters)
Validate that an attribute is between a given number of digits.
at line 1182
protected bool
validateSize(string $attribute, mixed $value, array $parameters)
Validate the size of an attribute.
at line 1197
protected bool
validateBetween(string $attribute, mixed $value, array $parameters)
Validate the size of an attribute is between a set of values.
at line 1214
protected bool
validateMin(string $attribute, mixed $value, array $parameters)
Validate the size of an attribute is greater than a minimum value.
at line 1229
protected bool
validateMax(string $attribute, mixed $value, array $parameters)
Validate the size of an attribute is less than a maximum value.
at line 1247
protected mixed
getSize(string $attribute, mixed $value)
Get the size of an attribute.
at line 1274
protected bool
validateIn(string $attribute, mixed $value, array $parameters)
Validate an attribute is contained within a list of values.
at line 1291
protected bool
validateNotIn(string $attribute, mixed $value, array $parameters)
Validate an attribute is not contained within a list of values.
at line 1304
protected bool
validateDistinct(string $attribute, mixed $value, array $parameters)
Validate an attribute is unique among other values.
at line 1329
protected bool
validateUnique(string $attribute, mixed $value, array $parameters)
Validate the uniqueness of an attribute value on a given database table.
If a database column is not specified, the attribute will be used.
at line 1379
protected array
parseTable(string $table)
Parse the connection / table for the unique / exists rules.
at line 1390
protected array
getUniqueIds(array $parameters)
Get the excluded ID column and value for the unique rule.
at line 1403
protected array
getUniqueExtra(array $parameters)
Get the extra conditions for a unique rule.
at line 1420
protected bool
validateExists(string $attribute, mixed $value, array $parameters)
Validate the existence of an attribute value in a database table.
at line 1449
protected int
getExistCount(mixed $connection, string $table, string $column, mixed $value, array $parameters)
Get the number of records that exist in storage.
at line 1470
protected array
getExtraExistConditions(array $parameters)
Get the extra exist conditions.
at line 1481
protected array
getExtraConditions(array $segments)
Get the extra conditions for a unique / exists rule.
at line 1500
string
guessColumnForQuery(string $attribute)
Guess the database column from the given attribute name.
at line 1517
protected bool
validateIp(string $attribute, mixed $value)
Validate that an attribute is a valid IP.
at line 1529
protected bool
validateEmail(string $attribute, mixed $value)
Validate that an attribute is a valid e-mail address.
at line 1541
protected bool
validateUrl(string $attribute, mixed $value)
Validate that an attribute is a valid URL.
at line 1574
protected bool
validateActiveUrl(string $attribute, mixed $value)
Validate that an attribute is an active URL.
at line 1594
protected bool
validateFile(string $attribute, mixed $value)
Validate the given value is a valid file.
at line 1606
protected bool
validateImage(string $attribute, mixed $value)
Validate the MIME type of a file is an image MIME type.
at line 1619
protected bool
validateDimensions(string $attribute, mixed $value, array $parameters)
Validate the dimensions of an image matches the given values.
at line 1661
protected bool
validateMimes(string $attribute, mixed $value, array $parameters)
Validate the guessed extension of a file upload is in a set of file extensions.
at line 1678
protected bool
validateMimetypes(string $attribute, mixed $value, array $parameters)
Validate the MIME type of a file upload attribute is in a set of MIME types.
at line 1693
bool
isAValidFileInstance(mixed $value)
Check that the given value is a valid file instance.
at line 1709
protected bool
validateAlpha(string $attribute, mixed $value)
Validate that an attribute contains only alphabetic characters.
at line 1721
protected bool
validateAlphaNum(string $attribute, mixed $value)
Validate that an attribute contains only alpha-numeric characters.
at line 1737
protected bool
validateAlphaDash(string $attribute, mixed $value)
Validate that an attribute contains only alpha-numeric characters, dashes, and underscores.
at line 1754
protected bool
validateRegex(string $attribute, mixed $value, array $parameters)
Validate that an attribute passes a regular expression check.
at line 1772
protected bool
validateDate(string $attribute, mixed $value)
Validate that an attribute is a valid date.
at line 1795
protected bool
validateDateFormat(string $attribute, mixed $value, array $parameters)
Validate that an attribute matches a date format.
at line 1816
protected bool
validateBefore(string $attribute, mixed $value, array $parameters)
Validate the date is before a given date.
at line 1843
protected bool
validateBeforeWithFormat(string $format, mixed $value, array $parameters)
Validate the date is before a given date with a given format.
at line 1858
protected bool
validateAfter(string $attribute, mixed $value, array $parameters)
Validate the date is after a given date.
at line 1885
protected bool
validateAfterWithFormat(string $format, mixed $value, array $parameters)
Validate the date is after a given date with a given format.
at line 1900
protected bool
checkDateTimeOrder(string $format, string $before, string $after)
Given two date/time strings, check that one is after the other.
at line 1916
protected DateTime|null
getDateTimeWithOptionalFormat(string $format, string $value)
Get a DateTime instance from a string.
at line 1938
protected bool
validateTimezone(string $attribute, mixed $value)
Validate that an attribute is a valid timezone.
at line 1955
protected string|null
getDateFormat(string $attribute)
Get the date format for an attribute if it has one.
at line 1968
protected int
getDateTimestamp(mixed $value)
Get the date timestamp.
at line 1980
protected string
getMessage(string $attribute, string $rule)
Get the validation message for an attribute and rule.
at line 2033
protected string|null
getInlineMessage(string $attribute, string $lowerRule, array $source = null)
Get the inline message for a rule if it exists.
at line 2057
protected string
getCustomMessageFromTranslator(string $customKey)
Get the custom error message from translator.
at line 2085
protected string
getSizeMessage(string $attribute, string $rule)
Get the proper error message for an attribute and size rule.
at line 2105
protected string
getAttributeType(string $attribute)
Get the data type of the given attribute.
at line 2130
protected string
doReplacements(string $message, string $attribute, string $rule, array $parameters)
Replace all error message place-holders with actual values.
at line 2155
protected array
getAttributeList(array $values)
Transform an array of attributes to their displayable form.
at line 2175
protected string
getAttribute(string $attribute)
Get the displayable name of the attribute.
at line 2217
protected string
getPrimaryAttribute(string $attribute)
Get the primary attribute name.
For example, if "name.0" is given, "name.*" will be returned.
at line 2235
string
getDisplayableValue(string $attribute, mixed $value)
Get the displayable name of the value.
at line 2259
protected string
replaceBetween(string $message, string $attribute, string $rule, array $parameters)
Replace all place-holders for the between rule.
at line 2273
protected string
replaceDateFormat(string $message, string $attribute, string $rule, array $parameters)
Replace all place-holders for the date_format rule.
at line 2287
protected string
replaceDifferent(string $message, string $attribute, string $rule, array $parameters)
Replace all place-holders for the different rule.
at line 2301
protected string
replaceDigits(string $message, string $attribute, string $rule, array $parameters)
Replace all place-holders for the digits rule.
at line 2315
protected string
replaceDigitsBetween(string $message, string $attribute, string $rule, array $parameters)
Replace all place-holders for the digits (between) rule.
at line 2329
protected string
replaceMin(string $message, string $attribute, string $rule, array $parameters)
Replace all place-holders for the min rule.
at line 2343
protected string
replaceMax(string $message, string $attribute, string $rule, array $parameters)
Replace all place-holders for the max rule.
at line 2357
protected string
replaceIn(string $message, string $attribute, string $rule, array $parameters)
Replace all place-holders for the in rule.
at line 2375
protected string
replaceNotIn(string $message, string $attribute, string $rule, array $parameters)
Replace all place-holders for the not_in rule.
at line 2389
protected string
replaceInArray(string $message, string $attribute, string $rule, array $parameters)
Replace all place-holders for the in_array rule.
at line 2403
protected string
replaceMimes(string $message, string $attribute, string $rule, array $parameters)
Replace all place-holders for the mimes rule.
at line 2417
protected string
replaceRequiredWith(string $message, string $attribute, string $rule, array $parameters)
Replace all place-holders for the required_with rule.
at line 2433
protected string
replaceRequiredWithAll(string $message, string $attribute, string $rule, array $parameters)
Replace all place-holders for the required_with_all rule.
at line 2447
protected string
replaceRequiredWithout(string $message, string $attribute, string $rule, array $parameters)
Replace all place-holders for the required_without rule.
at line 2461
protected string
replaceRequiredWithoutAll(string $message, string $attribute, string $rule, array $parameters)
Replace all place-holders for the required_without_all rule.
at line 2475
protected string
replaceSize(string $message, string $attribute, string $rule, array $parameters)
Replace all place-holders for the size rule.
at line 2489
protected string
replaceRequiredIf(string $message, string $attribute, string $rule, array $parameters)
Replace all place-holders for the required_if rule.
at line 2507
protected string
replaceRequiredUnless(string $message, string $attribute, string $rule, array $parameters)
Replace all place-holders for the required_unless rule.
at line 2523
protected string
replaceSame(string $message, string $attribute, string $rule, array $parameters)
Replace all place-holders for the same rule.
at line 2537
protected string
replaceBefore(string $message, string $attribute, string $rule, array $parameters)
Replace all place-holders for the before rule.
at line 2555
protected string
replaceAfter(string $message, string $attribute, string $rule, array $parameters)
Replace all place-holders for the after rule.
at line 2565
array
attributes()
Get all attributes.
at line 2576
bool
hasAttribute(string $attribute)
Checks if an attribute exists.
at line 2588
bool
hasRule(string $attribute, string|array $rules)
Determine if the given attribute has a rule in the given set.
at line 2600
protected array|null
getRule(string $attribute, string|array $rules)
Get a rule and its parameters for a given attribute.
at line 2623
protected array
parseRule(array|string $rules)
Extract the rule name and parameters from a rule.
at line 2642
protected array
parseArrayRule(array $rules)
Parse an array based rule.
at line 2653
protected array
parseStringRule(string $rules)
Parse a string based rule.
at line 2676
protected array
parseParameters(string $rule, string $parameter)
Parse a parameter list.
at line 2691
protected array
parseNamedParameters(array $parameters)
Parse named parameters to $key => $value items.
at line 2708
protected string
normalizeRule(string $rule)
Normalizes a rule so that we can accept short types.
at line 2726
protected bool
dependsOnOtherFields(string $rule)
Determine if the given rule depends on other fields.
at line 2739
protected array
getExplicitKeys(string $attribute)
Get the explicit keys from an attribute flattened with dot notation.
E.g. 'foo.1.bar.spark.baz' -> [1, 'spark'] for 'foo..bar..baz'
at line 2762
protected string
getLeadingExplicitAttributePath(string $attribute)
Get the explicit part of the attribute name.
E.g. 'foo.bar.*.baz' -> 'foo.bar'
Allows us to not spin through all of the flattened data for some operations.
at line 2775
protected array
extractDataFromPath(string $attribute)
Extract data based on the given dot-notated path.
Used to extract a sub-section of the data for faster iteration.
at line 2795
protected array
replaceAsterisksInParameters(array $parameters, array $keys)
Replace each field parameter which has asterisks with the given keys.
at line 2811
protected string
replaceAsterisksWithKeys(string $field, array $keys)
Replace asterisks with explicit keys.
E.g. 'foo..bar..baz', [1, 'spark'] -> foo.1.bar.spark.baz
at line 2821
array
getExtensions()
Get the array of custom validator extensions.
at line 2832
void
addExtensions(array $extensions)
Register an array of custom validator extensions.
at line 2849
void
addImplicitExtensions(array $extensions)
Register an array of custom implicit validator extensions.
at line 2865
void
addExtension(string $rule, Closure|string $extension)
Register a custom validator extension.
at line 2877
void
addImplicitExtension(string $rule, Closure|string $extension)
Register a custom implicit validator extension.
at line 2889
array
getReplacers()
Get the array of custom validator message replacers.
at line 2900
void
addReplacers(array $replacers)
Register an array of custom validator message replacers.
at line 2918
void
addReplacer(string $rule, Closure|string $replacer)
Register a custom validator message replacer.
at line 2928
array
getData()
Get the data under validation.
at line 2939
$this
setData(array $data)
Set the data under validation.
at line 2953
array
getRules()
Get the validation rules.
at line 2964
$this
setRules(array $rules)
Set the validation rules.
at line 2983
$this
setAttributeNames(array $attributes)
Set the custom attributes on the validator.
at line 2996
$this
setValueNames(array $values)
Set the custom values on the validator.
at line 3008
array
getFiles()
Get the files under validation.
at line 3019
$this
setFiles(array $files)
Set the files under validation.
at line 3033
PresenceVerifierInterface
getPresenceVerifier()
Get the Presence Verifier implementation.
at line 3048
void
setPresenceVerifier(PresenceVerifierInterface $presenceVerifier)
Set the Presence Verifier implementation.
at line 3058
TranslatorInterface
getTranslator()
Get the Translator implementation.
at line 3069
void
setTranslator(TranslatorInterface $translator)
Set the Translator implementation.
at line 3079
array
getCustomMessages()
Get the custom messages for the validator.
at line 3090
void
setCustomMessages(array $messages)
Set the custom messages for the validator.
at line 3100
array
getCustomAttributes()
Get the custom attributes used by the validator.
at line 3111
$this
addCustomAttributes(array $customAttributes)
Add custom attributes to the validator.
at line 3123
array
getCustomValues()
Get the custom values for the validator.
at line 3134
$this
addCustomValues(array $customValues)
Add the custom values for the validator.
at line 3146
array
getFallbackMessages()
Get the fallback messages for the validator.
at line 3157
void
setFallbackMessages(array $messages)
Set the fallback messages for the validator.
at line 3167
array
failed()
Get the failed validation rules.
at line 3177
MessageBag
messages()
Get the message container for the validator.
at line 3191
MessageBag
errors()
An alternative more semantic shortcut to the message container.
at line 3201
MessageBag
getMessageBag()
Get the messages for the instance.
at line 3224
protected bool|null
callExtension(string $rule, array $parameters)
Call a custom validator extension.
at line 3242
protected bool
callClassBasedExtension(string $callback, array $parameters)
Call a class based validator extension.
at line 3262
protected string|null
callReplacer(string $message, string $attribute, string $rule, array $parameters)
Call a custom validator message replacer.
at line 3283
protected string
callClassBasedReplacer(string $callback, string $message, string $attribute, string $rule, array $parameters)
Call a class based validator message replacer.
at line 3300
protected void
requireParameterCount(int $count, array $parameters, string $rule)
Require a certain number of parameters to be present.
at line 3316
mixed
__call(string $method, array $parameters)
Handle dynamic calls to class methods.