class Validator implements Validator

Traits

Properties

protected Translator $translator

The Translator implementation.

protected Container $container

The container instance.

protected PresenceVerifierInterface $presenceVerifier

The Presence Verifier implementation.

protected array $failedRules

The failed validation rules.

protected MessageBag $messages

The message bag instance.

protected array $data

The data under validation.

protected array $initialRules

The initial rules provided.

protected array $rules

The rules to be applied to the data.

protected string $currentRule

The current rule that is validating.

protected array $implicitAttributes

The array of wildcard attributes with their asterisks expanded.

protected array $after

All of the registered "after" callbacks.

array $customMessages

The array of custom error messages.

array $fallbackMessages

The array of fallback error messages.

array $customAttributes

The array of custom attribute names.

array $customValues

The array of custom displayable values.

array $extensions

All of the custom validator extensions.

array $replacers

All of the custom replacer extensions.

protected array $fileRules

The validation rules that may be applied to files.

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.

protected array $sizeRules

The size related validation rules.

protected array $numericRules

The numeric related validation rules.

Methods

string
replaceBetween(string $message, string $attribute, string $rule, array $parameters)

Replace all place-holders for the between rule.

string
replaceDateFormat(string $message, string $attribute, string $rule, array $parameters)

Replace all place-holders for the date_format rule.

string
replaceDifferent(string $message, string $attribute, string $rule, array $parameters)

Replace all place-holders for the different rule.

string
replaceDigits(string $message, string $attribute, string $rule, array $parameters)

Replace all place-holders for the digits rule.

string
replaceDigitsBetween(string $message, string $attribute, string $rule, array $parameters)

Replace all place-holders for the digits (between) rule.

string
replaceMin(string $message, string $attribute, string $rule, array $parameters)

Replace all place-holders for the min rule.

string
replaceMax(string $message, string $attribute, string $rule, array $parameters)

Replace all place-holders for the max rule.

string
replaceIn(string $message, string $attribute, string $rule, array $parameters)

Replace all place-holders for the in rule.

string
replaceNotIn(string $message, string $attribute, string $rule, array $parameters)

Replace all place-holders for the not_in rule.

string
replaceInArray(string $message, string $attribute, string $rule, array $parameters)

Replace all place-holders for the in_array rule.

string
replaceMimetypes(string $message, string $attribute, string $rule, array $parameters)

Replace all place-holders for the mimetypes rule.

string
replaceMimes(string $message, string $attribute, string $rule, array $parameters)

Replace all place-holders for the mimes rule.

string
replaceRequiredWith(string $message, string $attribute, string $rule, array $parameters)

Replace all place-holders for the required_with rule.

string
replaceRequiredWithAll(string $message, string $attribute, string $rule, array $parameters)

Replace all place-holders for the required_with_all rule.

string
replaceRequiredWithout(string $message, string $attribute, string $rule, array $parameters)

Replace all place-holders for the required_without rule.

string
replaceRequiredWithoutAll(string $message, string $attribute, string $rule, array $parameters)

Replace all place-holders for the required_without_all rule.

string
replaceSize(string $message, string $attribute, string $rule, array $parameters)

Replace all place-holders for the size rule.

string
replaceRequiredIf(string $message, string $attribute, string $rule, array $parameters)

Replace all place-holders for the required_if rule.

string
replaceRequiredUnless(string $message, string $attribute, string $rule, array $parameters)

Replace all place-holders for the required_unless rule.

string
replaceSame(string $message, string $attribute, string $rule, array $parameters)

Replace all place-holders for the same rule.

string
replaceBefore(string $message, string $attribute, string $rule, array $parameters)

Replace all place-holders for the before rule.

string
replaceBeforeOrEqual(string $message, string $attribute, string $rule, array $parameters)

Replace all place-holders for the before_or_equal rule.

string
replaceAfter(string $message, string $attribute, string $rule, array $parameters)

Replace all place-holders for the after rule.

string
replaceAfterOrEqual(string $message, string $attribute, string $rule, array $parameters)

Replace all place-holders for the after_or_equal rule.

string
replaceDimensions(string $message, string $attribute, string $rule, array $parameters)

Replace all place-holders for the dimensions rule.

string
getMessage(string $attribute, string $rule)

Get the validation message for an attribute and rule.

string|null
getFromLocalArray(string $attribute, string $lowerRule, array|null $source = null)

Get the inline message for a rule if it exists.

string
getCustomMessageFromTranslator(string $key)

Get the custom error message from translator.

string
getWildcardCustomMessages(array $messages, string $search, string $default)

Check the given messages for a wildcard key.

string
getSizeMessage(string $attribute, string $rule)

Get the proper error message for an attribute and size rule.

string
getAttributeType(string $attribute)

Get the data type of the given attribute.

string
makeReplacements(string $message, string $attribute, string $rule, array $parameters)

Replace all error message place-holders with actual values.

string
getDisplayableAttribute(string $attribute)

Get the displayable name of the attribute.

string
getAttributeFromTranslations(string $name)

Get the given attribute from the attribute translations.

string
replaceAttributePlaceholder(string $message, string $value)

Replace the :attribute placeholder in the given message.

string
getDisplayableValue(string $attribute, mixed $value)

Get the displayable name of the value.

array
getAttributeList(array $values)

Transform an array of attributes to their displayable form.

string|null
callReplacer(string $message, string $attribute, string $rule, array $parameters, Validator $validator)

Call a custom validator message replacer.

string
callClassBasedReplacer(string $callback, string $message, string $attribute, string $rule, array $parameters, Validator $validator)

Call a class based validator message replacer.

bool
validateAccepted(string $attribute, mixed $value)

Validate that an attribute was "accepted".

bool
validateActiveUrl(string $attribute, mixed $value)

Validate that an attribute is an active URL.

bool
validateBail()

"Break" on first validation fail.

bool
validateBefore(string $attribute, mixed $value, array $parameters)

Validate the date is before a given date.

bool
validateBeforeOrEqual(string $attribute, mixed $value, array $parameters)

Validate the date is before or equal a given date.

bool
validateAfter(string $attribute, mixed $value, array $parameters)

Validate the date is after a given date.

bool
validateAfterOrEqual(string $attribute, mixed $value, array $parameters)

Validate the date is equal or after a given date.

bool
compareDates(string $attribute, mixed $value, array $parameters, string $operator)

Compare a given date against another using an operator.

string|null
getDateFormat(string $attribute)

Get the date format for an attribute if it has one.

int
getDateTimestamp(mixed $value)

Get the date timestamp.

bool
checkDateTimeOrder(string $format, string $first, string $second, string $operator)

Given two date/time strings, check that one is after the other.

DateTime|null
getDateTimeWithOptionalFormat(string $format, string $value)

Get a DateTime instance from a string.

bool
validateAlpha(string $attribute, mixed $value)

Validate that an attribute contains only alphabetic characters.

bool
validateAlphaDash(string $attribute, mixed $value)

Validate that an attribute contains only alpha-numeric characters, dashes, and underscores.

bool
validateAlphaNum(string $attribute, mixed $value)

Validate that an attribute contains only alpha-numeric characters.

bool
validateArray(string $attribute, mixed $value)

Validate that an attribute is an array.

bool
validateBetween(string $attribute, mixed $value, array $parameters)

Validate the size of an attribute is between a set of values.

bool
validateBoolean(string $attribute, mixed $value)

Validate that an attribute is a boolean.

bool
validateConfirmed(string $attribute, mixed $value)

Validate that an attribute has a matching confirmation.

bool
validateDate(string $attribute, mixed $value)

Validate that an attribute is a valid date.

bool
validateDateFormat(string $attribute, mixed $value, array $parameters)

Validate that an attribute matches a date format.

bool
validateDifferent(string $attribute, mixed $value, array $parameters)

Validate that an attribute is different from another attribute.

bool
validateDigits(string $attribute, mixed $value, array $parameters)

Validate that an attribute has a given number of digits.

bool
validateDigitsBetween(string $attribute, mixed $value, array $parameters)

Validate that an attribute is between a given number of digits.

bool
validateDimensions(string $attribute, mixed $value, array $parameters)

Validate the dimensions of an image matches the given values.

bool
failsBasicDimensionChecks(array $parameters, int $width, int $height)

Test if the given width and height fail any conditions.

bool
failsRatioCheck(array $parameters, int $width, int $height)

Determine if the given parameters fail a dimension ratio check.

bool
validateDistinct(string $attribute, mixed $value, array $parameters)

Validate an attribute is unique among other values.

bool
validateEmail(string $attribute, mixed $value)

Validate that an attribute is a valid e-mail address.

bool
validateExists(string $attribute, mixed $value, array $parameters)

Validate the existence of an attribute value in a database table.

int
getExistCount(mixed $connection, string $table, string $column, mixed $value, array $parameters)

Get the number of records that exist in storage.

bool
validateUnique(string $attribute, mixed $value, array $parameters)

Validate the uniqueness of an attribute value on a given database table.

array
getUniqueIds(array $parameters)

Get the excluded ID column and value for the unique rule.

int
prepareUniqueId(mixed $id)

Prepare the given ID for querying.

array
getUniqueExtra(array $parameters)

Get the extra conditions for a unique rule.

array
parseTable(string $table)

Parse the connection / table for the unique / exists rules.

bool
getQueryColumn(array $parameters, string $attribute)

Get the column name for an exists / unique query.

string
guessColumnForQuery(string $attribute)

Guess the database column from the given attribute name.

array
getExtraConditions(array $segments)

Get the extra conditions for a unique / exists rule.

bool
validateFile(string $attribute, mixed $value)

Validate the given value is a valid file.

bool
validateFilled(string $attribute, mixed $value)

Validate the given attribute is filled if it is present.

bool
validateImage(string $attribute, mixed $value)

Validate the MIME type of a file is an image MIME type.

bool
validateIn(string $attribute, mixed $value, array $parameters)

Validate an attribute is contained within a list of values.

bool
validateInArray(string $attribute, mixed $value, array $parameters)

Validate that the values of an attribute is in another attribute.

bool
validateInteger(string $attribute, mixed $value)

Validate that an attribute is an integer.

bool
validateIp(string $attribute, mixed $value)

Validate that an attribute is a valid IP.

bool
validateIpv4(string $attribute, mixed $value)

Validate that an attribute is a valid IPv4.

bool
validateIpv6(string $attribute, mixed $value)

Validate that an attribute is a valid IPv6.

bool
validateJson(string $attribute, mixed $value)

Validate the attribute is a valid JSON string.

bool
validateMax(string $attribute, mixed $value, array $parameters)

Validate the size of an attribute is less than a maximum value.

bool
validateMimes(string $attribute, mixed $value, array $parameters)

Validate the guessed extension of a file upload is in a set of file extensions.

bool
validateMimetypes(string $attribute, mixed $value, array $parameters)

Validate the MIME type of a file upload attribute is in a set of MIME types.

bool
shouldBlockPhpUpload(mixed $value, array $parameters)

Check if PHP uploads are explicitly allowed.

bool
validateMin(string $attribute, mixed $value, array $parameters)

Validate the size of an attribute is greater than a minimum value.

bool
validateNullable()

"Indicate" validation should pass if value is null.

bool
validateNotIn(string $attribute, mixed $value, array $parameters)

Validate an attribute is not contained within a list of values.

bool
validateNumeric(string $attribute, mixed $value)

Validate that an attribute is numeric.

bool
validatePresent(string $attribute, mixed $value)

Validate that an attribute exists even if not filled.

bool
validateRegex(string $attribute, mixed $value, array $parameters)

Validate that an attribute passes a regular expression check.

bool
validateRequired(string $attribute, mixed $value)

Validate that a required attribute exists.

bool
validateRequiredIf(string $attribute, mixed $value, mixed $parameters)

Validate that an attribute exists when another attribute has a given value.

array
convertValuesToBoolean(array $values)

Convert the given values to boolean if they are string "true" / "false".

bool
validateRequiredUnless(string $attribute, mixed $value, mixed $parameters)

Validate that an attribute exists when another attribute does not have a given value.

bool
validateRequiredWith(string $attribute, mixed $value, mixed $parameters)

Validate that an attribute exists when any other attribute exists.

bool
validateRequiredWithAll(string $attribute, mixed $value, mixed $parameters)

Validate that an attribute exists when all other attributes exists.

bool
validateRequiredWithout(string $attribute, mixed $value, mixed $parameters)

Validate that an attribute exists when another attribute does not.

bool
validateRequiredWithoutAll(string $attribute, mixed $value, mixed $parameters)

Validate that an attribute exists when all other attributes do not.

bool
anyFailingRequired(array $attributes)

Determine if any of the given attributes fail the required test.

bool
allFailingRequired(array $attributes)

Determine if all of the given attributes fail the required test.

bool
validateSame(string $attribute, mixed $value, array $parameters)

Validate that two attributes match.

bool
validateSize(string $attribute, mixed $value, array $parameters)

Validate the size of an attribute.

bool
validateSometimes()

"Validate" optional attributes.

bool
validateString(string $attribute, mixed $value)

Validate that an attribute is a string.

bool
validateTimezone(string $attribute, mixed $value)

Validate that an attribute is a valid timezone.

bool
validateUrl(string $attribute, mixed $value)

Validate that an attribute is a valid URL.

mixed
getSize(string $attribute, mixed $value)

Get the size of an attribute.

bool
isValidFileInstance(mixed $value)

Check that the given value is a valid file instance.

bool
compare(mixed $first, mixed $second, string $operator)

Determine if a comparison passes between the given values.

array
parseNamedParameters(array $parameters)

Parse named parameters to $key => $value items.

void
requireParameterCount(int $count, array $parameters, string $rule)

Require a certain number of parameters to be present.

void
__construct(Translator $translator, array $data, array $rules, array $messages = [], array $customAttributes = [])

Create a new Validator instance.

array
parseData(array $data)

Parse the data array, converting dots to ->.

$this
after(callable|string $callback)

Add an after validation callback.

bool
passes()

Determine if the data passes the validation rules.

bool
fails()

Determine if the data fails the validation rules.

void
validate()

Run the validator's rules against its data.

void
validateAttribute(string $attribute, string $rule)

Validate a given attribute against a rule.

bool
dependsOnOtherFields(string $rule)

Determine if the given rule depends on other fields.

array
getExplicitKeys(string $attribute)

Get the explicit keys from an attribute flattened with dot notation.

string
getPrimaryAttribute(string $attribute)

Get the primary attribute name.

array
replaceAsterisksInParameters(array $parameters, array $keys)

Replace each field parameter which has asterisks with the given keys.

bool
isValidatable(string $rule, string $attribute, mixed $value)

Determine if the attribute is validatable.

bool
presentOrRuleIsImplicit(string $rule, string $attribute, mixed $value)

Determine if the field is present, or the rule implies required.

bool
isImplicit(string $rule)

Determine if a given rule implies the attribute is required.

bool
passesOptionalCheck(string $attribute)

Determine if the attribute passes any optional check.

bool
isNotNullIfMarkedAsNullable(string $rule, string $attribute)

Determine if the attribute fails the nullable check.

bool
hasNotFailedPreviousRuleIfPresenceRule(string $rule, string $attribute)

Determine if it's a necessary presence validation.

bool
shouldStopValidating(string $attribute)

Check if we should stop further validations on a given attribute.

void
addFailure(string $attribute, string $rule, array $parameters)

Add a failed rule and error message to the collection.

array
valid()

Returns the data which was valid.

array
invalid()

Returns the data which was invalid.

array
attributesThatHaveMessages()

Generate an array of all attributes that have messages.

array
failed()

Get the failed validation rules.

messages()

Get the message container for the validator.

errors()

An alternative more semantic shortcut to the message container.

getMessageBag()

Get the messages for the instance.

bool
hasRule(string $attribute, string|array $rules)

Determine if the given attribute has a rule in the given set.

array|null
getRule(string $attribute, string|array $rules)

Get a rule and its parameters for a given attribute.

array
attributes()

Get the data under validation.

array
getData()

Get the data under validation.

$this
setData(array $data)

Set the data under validation.

mixed
getValue(string $attribute)

Get the value of a given attribute.

array
getRules()

Get the validation rules.

$this
setRules(array $rules)

Set the validation rules.

void
addRules(array $rules)

Parse the given rules and merge them into current rules.

$this
sometimes(string $attribute, string|array $rules, callable $callback)

Add conditions to a given field based on a Closure.

void
addExtensions(array $extensions)

Register an array of custom validator extensions.

void
addImplicitExtensions(array $extensions)

Register an array of custom implicit validator extensions.

void
addDependentExtensions(array $extensions)

Register an array of custom implicit validator extensions.

void
addExtension(string $rule, Closure|string $extension)

Register a custom validator extension.

void
addImplicitExtension(string $rule, Closure|string $extension)

Register a custom implicit validator extension.

void
addDependentExtension(string $rule, Closure|string $extension)

Register a custom dependent validator extension.

void
addReplacers(array $replacers)

Register an array of custom validator message replacers.

void
addReplacer(string $rule, Closure|string $replacer)

Register a custom validator message replacer.

void
setCustomMessages(array $messages)

Set the custom messages for the validator.

$this
setAttributeNames(array $attributes)

Set the custom attributes on the validator.

$this
addCustomAttributes(array $customAttributes)

Add custom attributes to the validator.

$this
setValueNames(array $values)

Set the custom values on the validator.

$this
addCustomValues(array $customValues)

Add the custom values for the validator.

void
setFallbackMessages(array $messages)

Set the fallback messages for the validator.

getPresenceVerifier()

Get the Presence Verifier implementation.

getPresenceVerifierFor(string $connection)

Get the Presence Verifier implementation.

void
setPresenceVerifier(PresenceVerifierInterface $presenceVerifier)

Set the Presence Verifier implementation.

getTranslator()

Get the Translator implementation.

void
setTranslator(Translator $translator)

Set the Translator implementation.

void
setContainer(Container $container)

Set the IoC container instance.

bool|null
callExtension(string $rule, array $parameters)

Call a custom validator extension.

bool
callClassBasedExtension(string $callback, array $parameters)

Call a class based validator extension.

mixed
__call(string $method, array $parameters)

Handle dynamic calls to class methods.

Details

in ReplacesAttributes at line 18
protected string replaceBetween(string $message, string $attribute, string $rule, array $parameters)

Replace all place-holders for the between rule.

Parameters

string $message
string $attribute
string $rule
array $parameters

Return Value

string

in ReplacesAttributes at line 32
protected string replaceDateFormat(string $message, string $attribute, string $rule, array $parameters)

Replace all place-holders for the date_format rule.

Parameters

string $message
string $attribute
string $rule
array $parameters

Return Value

string

in ReplacesAttributes at line 46
protected string replaceDifferent(string $message, string $attribute, string $rule, array $parameters)

Replace all place-holders for the different rule.

Parameters

string $message
string $attribute
string $rule
array $parameters

Return Value

string

in ReplacesAttributes at line 60
protected string replaceDigits(string $message, string $attribute, string $rule, array $parameters)

Replace all place-holders for the digits rule.

Parameters

string $message
string $attribute
string $rule
array $parameters

Return Value

string

in ReplacesAttributes at line 74
protected string replaceDigitsBetween(string $message, string $attribute, string $rule, array $parameters)

Replace all place-holders for the digits (between) rule.

Parameters

string $message
string $attribute
string $rule
array $parameters

Return Value

string

in ReplacesAttributes at line 88
protected string replaceMin(string $message, string $attribute, string $rule, array $parameters)

Replace all place-holders for the min rule.

Parameters

string $message
string $attribute
string $rule
array $parameters

Return Value

string

in ReplacesAttributes at line 102
protected string replaceMax(string $message, string $attribute, string $rule, array $parameters)

Replace all place-holders for the max rule.

Parameters

string $message
string $attribute
string $rule
array $parameters

Return Value

string

in ReplacesAttributes at line 116
protected string replaceIn(string $message, string $attribute, string $rule, array $parameters)

Replace all place-holders for the in rule.

Parameters

string $message
string $attribute
string $rule
array $parameters

Return Value

string

in ReplacesAttributes at line 134
protected string replaceNotIn(string $message, string $attribute, string $rule, array $parameters)

Replace all place-holders for the not_in rule.

Parameters

string $message
string $attribute
string $rule
array $parameters

Return Value

string

in ReplacesAttributes at line 148
protected string replaceInArray(string $message, string $attribute, string $rule, array $parameters)

Replace all place-holders for the in_array rule.

Parameters

string $message
string $attribute
string $rule
array $parameters

Return Value

string

in ReplacesAttributes at line 162
protected string replaceMimetypes(string $message, string $attribute, string $rule, array $parameters)

Replace all place-holders for the mimetypes rule.

Parameters

string $message
string $attribute
string $rule
array $parameters

Return Value

string

in ReplacesAttributes at line 176
protected string replaceMimes(string $message, string $attribute, string $rule, array $parameters)

Replace all place-holders for the mimes rule.

Parameters

string $message
string $attribute
string $rule
array $parameters

Return Value

string

in ReplacesAttributes at line 190
protected string replaceRequiredWith(string $message, string $attribute, string $rule, array $parameters)

Replace all place-holders for the required_with rule.

Parameters

string $message
string $attribute
string $rule
array $parameters

Return Value

string

in ReplacesAttributes at line 204
protected string replaceRequiredWithAll(string $message, string $attribute, string $rule, array $parameters)

Replace all place-holders for the required_with_all rule.

Parameters

string $message
string $attribute
string $rule
array $parameters

Return Value

string

in ReplacesAttributes at line 218
protected string replaceRequiredWithout(string $message, string $attribute, string $rule, array $parameters)

Replace all place-holders for the required_without rule.

Parameters

string $message
string $attribute
string $rule
array $parameters

Return Value

string

in ReplacesAttributes at line 232
protected string replaceRequiredWithoutAll(string $message, string $attribute, string $rule, array $parameters)

Replace all place-holders for the required_without_all rule.

Parameters

string $message
string $attribute
string $rule
array $parameters

Return Value

string

in ReplacesAttributes at line 246
protected string replaceSize(string $message, string $attribute, string $rule, array $parameters)

Replace all place-holders for the size rule.

Parameters

string $message
string $attribute
string $rule
array $parameters

Return Value

string

in ReplacesAttributes at line 260
protected string replaceRequiredIf(string $message, string $attribute, string $rule, array $parameters)

Replace all place-holders for the required_if rule.

Parameters

string $message
string $attribute
string $rule
array $parameters

Return Value

string

in ReplacesAttributes at line 278
protected string replaceRequiredUnless(string $message, string $attribute, string $rule, array $parameters)

Replace all place-holders for the required_unless rule.

Parameters

string $message
string $attribute
string $rule
array $parameters

Return Value

string

in ReplacesAttributes at line 294
protected string replaceSame(string $message, string $attribute, string $rule, array $parameters)

Replace all place-holders for the same rule.

Parameters

string $message
string $attribute
string $rule
array $parameters

Return Value

string

in ReplacesAttributes at line 308
protected string replaceBefore(string $message, string $attribute, string $rule, array $parameters)

Replace all place-holders for the before rule.

Parameters

string $message
string $attribute
string $rule
array $parameters

Return Value

string

in ReplacesAttributes at line 326
protected string replaceBeforeOrEqual(string $message, string $attribute, string $rule, array $parameters)

Replace all place-holders for the before_or_equal rule.

Parameters

string $message
string $attribute
string $rule
array $parameters

Return Value

string

in ReplacesAttributes at line 340
protected string replaceAfter(string $message, string $attribute, string $rule, array $parameters)

Replace all place-holders for the after rule.

Parameters

string $message
string $attribute
string $rule
array $parameters

Return Value

string

in ReplacesAttributes at line 354
protected string replaceAfterOrEqual(string $message, string $attribute, string $rule, array $parameters)

Replace all place-holders for the after_or_equal rule.

Parameters

string $message
string $attribute
string $rule
array $parameters

Return Value

string

in ReplacesAttributes at line 368
protected string replaceDimensions(string $message, string $attribute, string $rule, array $parameters)

Replace all place-holders for the dimensions rule.

Parameters

string $message
string $attribute
string $rule
array $parameters

Return Value

string

in FormatsMessages at line 21
protected string getMessage(string $attribute, string $rule)

Get the validation message for an attribute and rule.

Parameters

string $attribute
string $rule

Return Value

string

in FormatsMessages at line 74
protected string|null getFromLocalArray(string $attribute, string $lowerRule, array|null $source = null)

Get the inline message for a rule if it exists.

Parameters

string $attribute
string $lowerRule
array|null $source

Return Value

string|null

in FormatsMessages at line 98
protected string getCustomMessageFromTranslator(string $key)

Get the custom error message from translator.

Parameters

string $key

Return Value

string

in FormatsMessages at line 124
protected string getWildcardCustomMessages(array $messages, string $search, string $default)

Check the given messages for a wildcard key.

Parameters

array $messages
string $search
string $default

Return Value

string

in FormatsMessages at line 142
protected string getSizeMessage(string $attribute, string $rule)

Get the proper error message for an attribute and size rule.

Parameters

string $attribute
string $rule

Return Value

string

in FormatsMessages at line 162
protected string getAttributeType(string $attribute)

Get the data type of the given attribute.

Parameters

string $attribute

Return Value

string

in FormatsMessages at line 187
string makeReplacements(string $message, string $attribute, string $rule, array $parameters)

Replace all error message place-holders with actual values.

Parameters

string $message
string $attribute
string $rule
array $parameters

Return Value

string

in FormatsMessages at line 208
string getDisplayableAttribute(string $attribute)

Get the displayable name of the attribute.

Parameters

string $attribute

Return Value

string

in FormatsMessages at line 247
protected string getAttributeFromTranslations(string $name)

Get the given attribute from the attribute translations.

Parameters

string $name

Return Value

string

in FormatsMessages at line 259
protected string replaceAttributePlaceholder(string $message, string $value)

Replace the :attribute placeholder in the given message.

Parameters

string $message
string $value

Return Value

string

in FormatsMessages at line 275
string getDisplayableValue(string $attribute, mixed $value)

Get the displayable name of the value.

Parameters

string $attribute
mixed $value

Return Value

string

in FormatsMessages at line 296
protected array getAttributeList(array $values)

Transform an array of attributes to their displayable form.

Parameters

array $values

Return Value

array

in FormatsMessages at line 320
protected string|null callReplacer(string $message, string $attribute, string $rule, array $parameters, Validator $validator)

Call a custom validator message replacer.

Parameters

string $message
string $attribute
string $rule
array $parameters
Validator $validator

Return Value

string|null

in FormatsMessages at line 342
protected string callClassBasedReplacer(string $callback, string $message, string $attribute, string $rule, array $parameters, Validator $validator)

Call a class based validator message replacer.

Parameters

string $callback
string $message
string $attribute
string $rule
array $parameters
Validator $validator

Return Value

string

protected bool validateAccepted(string $attribute, mixed $value)

Validate that an attribute was "accepted".

This validation rule implies the attribute is "required".

Parameters

string $attribute
mixed $value

Return Value

bool

protected bool validateActiveUrl(string $attribute, mixed $value)

Validate that an attribute is an active URL.

Parameters

string $attribute
mixed $value

Return Value

bool

protected bool validateBail()

"Break" on first validation fail.

Always returns true, just lets us put "bail" in rules.

Return Value

bool

protected bool validateBefore(string $attribute, mixed $value, array $parameters)

Validate the date is before a given date.

Parameters

string $attribute
mixed $value
array $parameters

Return Value

bool

protected bool validateBeforeOrEqual(string $attribute, mixed $value, array $parameters)

Validate the date is before or equal a given date.

Parameters

string $attribute
mixed $value
array $parameters

Return Value

bool

in ValidatesAttributes at line 112
protected bool validateAfter(string $attribute, mixed $value, array $parameters)

Validate the date is after a given date.

Parameters

string $attribute
mixed $value
array $parameters

Return Value

bool

in ValidatesAttributes at line 127
protected bool validateAfterOrEqual(string $attribute, mixed $value, array $parameters)

Validate the date is equal or after a given date.

Parameters

string $attribute
mixed $value
array $parameters

Return Value

bool

in ValidatesAttributes at line 143
protected bool compareDates(string $attribute, mixed $value, array $parameters, string $operator)

Compare a given date against another using an operator.

Parameters

string $attribute
mixed $value
array $parameters
string $operator

Return Value

bool

in ValidatesAttributes at line 168
protected string|null getDateFormat(string $attribute)

Get the date format for an attribute if it has one.

Parameters

string $attribute

Return Value

string|null

in ValidatesAttributes at line 181
protected int getDateTimestamp(mixed $value)

Get the date timestamp.

Parameters

mixed $value

Return Value

int

in ValidatesAttributes at line 195
protected bool checkDateTimeOrder(string $format, string $first, string $second, string $operator)

Given two date/time strings, check that one is after the other.

Parameters

string $format
string $first
string $second
string $operator

Return Value

bool

in ValidatesAttributes at line 211
protected DateTime|null getDateTimeWithOptionalFormat(string $format, string $value)

Get a DateTime instance from a string.

Parameters

string $format
string $value

Return Value

DateTime|null

in ValidatesAttributes at line 231
protected bool validateAlpha(string $attribute, mixed $value)

Validate that an attribute contains only alphabetic characters.

Parameters

string $attribute
mixed $value

Return Value

bool

in ValidatesAttributes at line 243
protected bool validateAlphaDash(string $attribute, mixed $value)

Validate that an attribute contains only alpha-numeric characters, dashes, and underscores.

Parameters

string $attribute
mixed $value

Return Value

bool

in ValidatesAttributes at line 259
protected bool validateAlphaNum(string $attribute, mixed $value)

Validate that an attribute contains only alpha-numeric characters.

Parameters

string $attribute
mixed $value

Return Value

bool

in ValidatesAttributes at line 275
protected bool validateArray(string $attribute, mixed $value)

Validate that an attribute is an array.

Parameters

string $attribute
mixed $value

Return Value

bool

in ValidatesAttributes at line 288
protected bool validateBetween(string $attribute, mixed $value, array $parameters)

Validate the size of an attribute is between a set of values.

Parameters

string $attribute
mixed $value
array $parameters

Return Value

bool

in ValidatesAttributes at line 304
protected bool validateBoolean(string $attribute, mixed $value)

Validate that an attribute is a boolean.

Parameters

string $attribute
mixed $value

Return Value

bool

in ValidatesAttributes at line 318
protected bool validateConfirmed(string $attribute, mixed $value)

Validate that an attribute has a matching confirmation.

Parameters

string $attribute
mixed $value

Return Value

bool

in ValidatesAttributes at line 330
protected bool validateDate(string $attribute, mixed $value)

Validate that an attribute is a valid date.

Parameters

string $attribute
mixed $value

Return Value

bool

in ValidatesAttributes at line 353
protected bool validateDateFormat(string $attribute, mixed $value, array $parameters)

Validate that an attribute matches a date format.

Parameters

string $attribute
mixed $value
array $parameters

Return Value

bool

in ValidatesAttributes at line 376
protected bool validateDifferent(string $attribute, mixed $value, array $parameters)

Validate that an attribute is different from another attribute.

Parameters

string $attribute
mixed $value
array $parameters

Return Value

bool

in ValidatesAttributes at line 399
protected bool validateDigits(string $attribute, mixed $value, array $parameters)

Validate that an attribute has a given number of digits.

Parameters

string $attribute
mixed $value
array $parameters

Return Value

bool

in ValidatesAttributes at line 415
protected bool validateDigitsBetween(string $attribute, mixed $value, array $parameters)

Validate that an attribute is between a given number of digits.

Parameters

string $attribute
mixed $value
array $parameters

Return Value

bool

in ValidatesAttributes at line 433
protected bool validateDimensions(string $attribute, mixed $value, array $parameters)

Validate the dimensions of an image matches the given values.

Parameters

string $attribute
mixed $value
array $parameters

Return Value

bool

in ValidatesAttributes at line 461
protected bool failsBasicDimensionChecks(array $parameters, int $width, int $height)

Test if the given width and height fail any conditions.

Parameters

array $parameters
int $width
int $height

Return Value

bool

in ValidatesAttributes at line 479
protected bool failsRatioCheck(array $parameters, int $width, int $height)

Determine if the given parameters fail a dimension ratio check.

Parameters

array $parameters
int $width
int $height

Return Value

bool

in ValidatesAttributes at line 502
protected bool validateDistinct(string $attribute, mixed $value, array $parameters)

Validate an attribute is unique among other values.

Parameters

string $attribute
mixed $value
array $parameters

Return Value

bool

in ValidatesAttributes at line 526
protected bool validateEmail(string $attribute, mixed $value)

Validate that an attribute is a valid e-mail address.

Parameters

string $attribute
mixed $value

Return Value

bool

in ValidatesAttributes at line 539
protected bool validateExists(string $attribute, mixed $value, array $parameters)

Validate the existence of an attribute value in a database table.

Parameters

string $attribute
mixed $value
array $parameters

Return Value

bool

in ValidatesAttributes at line 567
protected int getExistCount(mixed $connection, string $table, string $column, mixed $value, array $parameters)

Get the number of records that exist in storage.

Parameters

mixed $connection
string $table
string $column
mixed $value
array $parameters

Return Value

int

in ValidatesAttributes at line 594
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.

Parameters

string $attribute
mixed $value
array $parameters

Return Value

bool

in ValidatesAttributes at line 633
protected array getUniqueIds(array $parameters)

Get the excluded ID column and value for the unique rule.

Parameters

array $parameters

Return Value

array

in ValidatesAttributes at line 646
protected int prepareUniqueId(mixed $id)

Prepare the given ID for querying.

Parameters

mixed $id

Return Value

int

in ValidatesAttributes at line 669
protected array getUniqueExtra(array $parameters)

Get the extra conditions for a unique rule.

Parameters

array $parameters

Return Value

array

in ValidatesAttributes at line 684
protected array parseTable(string $table)

Parse the connection / table for the unique / exists rules.

Parameters

string $table

Return Value

array

in ValidatesAttributes at line 696
protected bool getQueryColumn(array $parameters, string $attribute)

Get the column name for an exists / unique query.

Parameters

array $parameters
string $attribute

Return Value

bool

in ValidatesAttributes at line 708
string guessColumnForQuery(string $attribute)

Guess the database column from the given attribute name.

Parameters

string $attribute

Return Value

string

in ValidatesAttributes at line 724
protected array getExtraConditions(array $segments)

Get the extra conditions for a unique / exists rule.

Parameters

array $segments

Return Value

array

in ValidatesAttributes at line 744
protected bool validateFile(string $attribute, mixed $value)

Validate the given value is a valid file.

Parameters

string $attribute
mixed $value

Return Value

bool

in ValidatesAttributes at line 756
protected bool validateFilled(string $attribute, mixed $value)

Validate the given attribute is filled if it is present.

Parameters

string $attribute
mixed $value

Return Value

bool

in ValidatesAttributes at line 772
protected bool validateImage(string $attribute, mixed $value)

Validate the MIME type of a file is an image MIME type.

Parameters

string $attribute
mixed $value

Return Value

bool

in ValidatesAttributes at line 785
protected bool validateIn(string $attribute, mixed $value, array $parameters)

Validate an attribute is contained within a list of values.

Parameters

string $attribute
mixed $value
array $parameters

Return Value

bool

in ValidatesAttributes at line 808
protected bool validateInArray(string $attribute, mixed $value, array $parameters)

Validate that the values of an attribute is in another attribute.

Parameters

string $attribute
mixed $value
array $parameters

Return Value

bool

in ValidatesAttributes at line 830
protected bool validateInteger(string $attribute, mixed $value)

Validate that an attribute is an integer.

Parameters

string $attribute
mixed $value

Return Value

bool

in ValidatesAttributes at line 842
protected bool validateIp(string $attribute, mixed $value)

Validate that an attribute is a valid IP.

Parameters

string $attribute
mixed $value

Return Value

bool

in ValidatesAttributes at line 854
protected bool validateIpv4(string $attribute, mixed $value)

Validate that an attribute is a valid IPv4.

Parameters

string $attribute
mixed $value

Return Value

bool

in ValidatesAttributes at line 866
protected bool validateIpv6(string $attribute, mixed $value)

Validate that an attribute is a valid IPv6.

Parameters

string $attribute
mixed $value

Return Value

bool

in ValidatesAttributes at line 878
protected bool validateJson(string $attribute, mixed $value)

Validate the attribute is a valid JSON string.

Parameters

string $attribute
mixed $value

Return Value

bool

in ValidatesAttributes at line 897
protected bool validateMax(string $attribute, mixed $value, array $parameters)

Validate the size of an attribute is less than a maximum value.

Parameters

string $attribute
mixed $value
array $parameters

Return Value

bool

in ValidatesAttributes at line 916
protected bool validateMimes(string $attribute, mixed $value, array $parameters)

Validate the guessed extension of a file upload is in a set of file extensions.

Parameters

string $attribute
mixed $value
array $parameters

Return Value

bool

in ValidatesAttributes at line 937
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.

Parameters

string $attribute
mixed $value
array $parameters

Return Value

bool

in ValidatesAttributes at line 959
protected bool shouldBlockPhpUpload(mixed $value, array $parameters)

Check if PHP uploads are explicitly allowed.

Parameters

mixed $value
array $parameters

Return Value

bool

in ValidatesAttributes at line 978
protected bool validateMin(string $attribute, mixed $value, array $parameters)

Validate the size of an attribute is greater than a minimum value.

Parameters

string $attribute
mixed $value
array $parameters

Return Value

bool

in ValidatesAttributes at line 992
protected bool validateNullable()

"Indicate" validation should pass if value is null.

Always returns true, just lets us put "nullable" in rules.

Return Value

bool

in ValidatesAttributes at line 1005
protected bool validateNotIn(string $attribute, mixed $value, array $parameters)

Validate an attribute is not contained within a list of values.

Parameters

string $attribute
mixed $value
array $parameters

Return Value

bool

in ValidatesAttributes at line 1017
protected bool validateNumeric(string $attribute, mixed $value)

Validate that an attribute is numeric.

Parameters

string $attribute
mixed $value

Return Value

bool

in ValidatesAttributes at line 1029
protected bool validatePresent(string $attribute, mixed $value)

Validate that an attribute exists even if not filled.

Parameters

string $attribute
mixed $value

Return Value

bool

in ValidatesAttributes at line 1042
protected bool validateRegex(string $attribute, mixed $value, array $parameters)

Validate that an attribute passes a regular expression check.

Parameters

string $attribute
mixed $value
array $parameters

Return Value

bool

in ValidatesAttributes at line 1060
protected bool validateRequired(string $attribute, mixed $value)

Validate that a required attribute exists.

Parameters

string $attribute
mixed $value

Return Value

bool

in ValidatesAttributes at line 1083
protected bool validateRequiredIf(string $attribute, mixed $value, mixed $parameters)

Validate that an attribute exists when another attribute has a given value.

Parameters

string $attribute
mixed $value
mixed $parameters

Return Value

bool

in ValidatesAttributes at line 1108
protected array convertValuesToBoolean(array $values)

Convert the given values to boolean if they are string "true" / "false".

Parameters

array $values

Return Value

array

in ValidatesAttributes at line 1129
protected bool validateRequiredUnless(string $attribute, mixed $value, mixed $parameters)

Validate that an attribute exists when another attribute does not have a given value.

Parameters

string $attribute
mixed $value
mixed $parameters

Return Value

bool

in ValidatesAttributes at line 1152
protected bool validateRequiredWith(string $attribute, mixed $value, mixed $parameters)

Validate that an attribute exists when any other attribute exists.

Parameters

string $attribute
mixed $value
mixed $parameters

Return Value

bool

in ValidatesAttributes at line 1169
protected bool validateRequiredWithAll(string $attribute, mixed $value, mixed $parameters)

Validate that an attribute exists when all other attributes exists.

Parameters

string $attribute
mixed $value
mixed $parameters

Return Value

bool

in ValidatesAttributes at line 1186
protected bool validateRequiredWithout(string $attribute, mixed $value, mixed $parameters)

Validate that an attribute exists when another attribute does not.

Parameters

string $attribute
mixed $value
mixed $parameters

Return Value

bool

in ValidatesAttributes at line 1203
protected bool validateRequiredWithoutAll(string $attribute, mixed $value, mixed $parameters)

Validate that an attribute exists when all other attributes do not.

Parameters

string $attribute
mixed $value
mixed $parameters

Return Value

bool

in ValidatesAttributes at line 1218
protected bool anyFailingRequired(array $attributes)

Determine if any of the given attributes fail the required test.

Parameters

array $attributes

Return Value

bool

in ValidatesAttributes at line 1235
protected bool allFailingRequired(array $attributes)

Determine if all of the given attributes fail the required test.

Parameters

array $attributes

Return Value

bool

in ValidatesAttributes at line 1254
protected bool validateSame(string $attribute, mixed $value, array $parameters)

Validate that two attributes match.

Parameters

string $attribute
mixed $value
array $parameters

Return Value

bool

in ValidatesAttributes at line 1271
protected bool validateSize(string $attribute, mixed $value, array $parameters)

Validate the size of an attribute.

Parameters

string $attribute
mixed $value
array $parameters

Return Value

bool

in ValidatesAttributes at line 1285
protected bool validateSometimes()

"Validate" optional attributes.

Always returns true, just lets us put sometimes in rules.

Return Value

bool

in ValidatesAttributes at line 1297
protected bool validateString(string $attribute, mixed $value)

Validate that an attribute is a string.

Parameters

string $attribute
mixed $value

Return Value

bool

in ValidatesAttributes at line 1309
protected bool validateTimezone(string $attribute, mixed $value)

Validate that an attribute is a valid timezone.

Parameters

string $attribute
mixed $value

Return Value

bool

in ValidatesAttributes at line 1329
protected bool validateUrl(string $attribute, mixed $value)

Validate that an attribute is a valid URL.

Parameters

string $attribute
mixed $value

Return Value

bool

in ValidatesAttributes at line 1366
protected mixed getSize(string $attribute, mixed $value)

Get the size of an attribute.

Parameters

string $attribute
mixed $value

Return Value

mixed

in ValidatesAttributes at line 1391
bool isValidFileInstance(mixed $value)

Check that the given value is a valid file instance.

Parameters

mixed $value

Return Value

bool

in ValidatesAttributes at line 1408
protected bool compare(mixed $first, mixed $second, string $operator)

Determine if a comparison passes between the given values.

Parameters

mixed $first
mixed $second
string $operator

Return Value

bool

in ValidatesAttributes at line 1430
protected array parseNamedParameters(array $parameters)

Parse named parameters to $key => $value items.

Parameters

array $parameters

Return Value

array

in ValidatesAttributes at line 1451
protected void requireParameterCount(int $count, array $parameters, string $rule)

Require a certain number of parameters to be present.

Parameters

int $count
array $parameters
string $rule

Return Value

void

Exceptions

InvalidArgumentException

at line 196
void __construct(Translator $translator, array $data, array $rules, array $messages = [], array $customAttributes = [])

Create a new Validator instance.

Parameters

Translator $translator
array $data
array $rules
array $messages
array $customAttributes

Return Value

void

at line 214
array parseData(array $data)

Parse the data array, converting dots to ->.

Parameters

array $data

Return Value

array

at line 242
$this after(callable|string $callback)

Add an after validation callback.

Parameters

callable|string $callback

Return Value

$this

at line 256
bool passes()

Determine if the data passes the validation rules.

Return Value

bool

at line 290
bool fails()

Determine if the data fails the validation rules.

Return Value

bool

at line 302
void validate()

Run the validator's rules against its data.

Return Value

void

Exceptions

ValidationException

at line 316
protected void validateAttribute(string $attribute, string $rule)

Validate a given attribute against a rule.

Parameters

string $attribute
string $rule

Return Value

void

at line 363
protected bool dependsOnOtherFields(string $rule)

Determine if the given rule depends on other fields.

Parameters

string $rule

Return Value

bool

at line 376
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'

Parameters

string $attribute

Return Value

array

at line 397
protected string getPrimaryAttribute(string $attribute)

Get the primary attribute name.

For example, if "name.0" is given, "name.*" will be returned.

Parameters

string $attribute

Return Value

string

at line 415
protected array replaceAsterisksInParameters(array $parameters, array $keys)

Replace each field parameter which has asterisks with the given keys.

Parameters

array $parameters
array $keys

Return Value

array

at line 430
protected bool isValidatable(string $rule, string $attribute, mixed $value)

Determine if the attribute is validatable.

Parameters

string $rule
string $attribute
mixed $value

Return Value

bool

at line 446
protected bool presentOrRuleIsImplicit(string $rule, string $attribute, mixed $value)

Determine if the field is present, or the rule implies required.

Parameters

string $rule
string $attribute
mixed $value

Return Value

bool

at line 461
protected bool isImplicit(string $rule)

Determine if a given rule implies the attribute is required.

Parameters

string $rule

Return Value

bool

at line 472
protected bool passesOptionalCheck(string $attribute)

Determine if the attribute passes any optional check.

Parameters

string $attribute

Return Value

bool

at line 491
protected bool isNotNullIfMarkedAsNullable(string $rule, string $attribute)

Determine if the attribute fails the nullable check.

Parameters

string $rule
string $attribute

Return Value

bool

at line 509
protected bool hasNotFailedPreviousRuleIfPresenceRule(string $rule, string $attribute)

Determine if it's a necessary presence validation.

This is to avoid possible database type comparison errors.

Parameters

string $rule
string $attribute

Return Value

bool

at line 520
protected bool shouldStopValidating(string $attribute)

Check if we should stop further validations on a given attribute.

Parameters

string $attribute

Return Value

bool

at line 547
protected void addFailure(string $attribute, string $rule, array $parameters)

Add a failed rule and error message to the collection.

Parameters

string $attribute
string $rule
array $parameters

Return Value

void

at line 561
array valid()

Returns the data which was valid.

Return Value

array

at line 577
array invalid()

Returns the data which was invalid.

Return Value

array

at line 593
protected array attributesThatHaveMessages()

Generate an array of all attributes that have messages.

Return Value

array

at line 605
array failed()

Get the failed validation rules.

Return Value

array

at line 615
MessageBag messages()

Get the message container for the validator.

Return Value

MessageBag

at line 629
MessageBag errors()

An alternative more semantic shortcut to the message container.

Return Value

MessageBag

at line 639
MessageBag getMessageBag()

Get the messages for the instance.

Return Value

MessageBag

at line 651
bool hasRule(string $attribute, string|array $rules)

Determine if the given attribute has a rule in the given set.

Parameters

string $attribute
string|array $rules

Return Value

bool

at line 663
protected array|null getRule(string $attribute, string|array $rules)

Get a rule and its parameters for a given attribute.

Parameters

string $attribute
string|array $rules

Return Value

array|null

at line 685
array attributes()

Get the data under validation.

Return Value

array

at line 695
array getData()

Get the data under validation.

Return Value

array

at line 706
$this setData(array $data)

Set the data under validation.

Parameters

array $data

Return Value

$this

at line 721
protected mixed getValue(string $attribute)

Get the value of a given attribute.

Parameters

string $attribute

Return Value

mixed

at line 731
array getRules()

Get the validation rules.

Return Value

array

at line 742
$this setRules(array $rules)

Set the validation rules.

Parameters

array $rules

Return Value

$this

at line 759
void addRules(array $rules)

Parse the given rules and merge them into current rules.

Parameters

array $rules

Return Value

void

at line 784
$this sometimes(string $attribute, string|array $rules, callable $callback)

Add conditions to a given field based on a Closure.

Parameters

string $attribute
string|array $rules
callable $callback

Return Value

$this

at line 803
void addExtensions(array $extensions)

Register an array of custom validator extensions.

Parameters

array $extensions

Return Value

void

at line 820
void addImplicitExtensions(array $extensions)

Register an array of custom implicit validator extensions.

Parameters

array $extensions

Return Value

void

at line 835
void addDependentExtensions(array $extensions)

Register an array of custom implicit validator extensions.

Parameters

array $extensions

Return Value

void

at line 851
void addExtension(string $rule, Closure|string $extension)

Register a custom validator extension.

Parameters

string $rule
Closure|string $extension

Return Value

void

at line 863
void addImplicitExtension(string $rule, Closure|string $extension)

Register a custom implicit validator extension.

Parameters

string $rule
Closure|string $extension

Return Value

void

at line 877
void addDependentExtension(string $rule, Closure|string $extension)

Register a custom dependent validator extension.

Parameters

string $rule
Closure|string $extension

Return Value

void

at line 890
void addReplacers(array $replacers)

Register an array of custom validator message replacers.

Parameters

array $replacers

Return Value

void

at line 908
void addReplacer(string $rule, Closure|string $replacer)

Register a custom validator message replacer.

Parameters

string $rule
Closure|string $replacer

Return Value

void

at line 919
void setCustomMessages(array $messages)

Set the custom messages for the validator.

Parameters

array $messages

Return Value

void

at line 930
$this setAttributeNames(array $attributes)

Set the custom attributes on the validator.

Parameters

array $attributes

Return Value

$this

at line 943
$this addCustomAttributes(array $customAttributes)

Add custom attributes to the validator.

Parameters

array $customAttributes

Return Value

$this

at line 956
$this setValueNames(array $values)

Set the custom values on the validator.

Parameters

array $values

Return Value

$this

at line 969
$this addCustomValues(array $customValues)

Add the custom values for the validator.

Parameters

array $customValues

Return Value

$this

at line 982
void setFallbackMessages(array $messages)

Set the fallback messages for the validator.

Parameters

array $messages

Return Value

void

at line 994
PresenceVerifierInterface getPresenceVerifier()

Get the Presence Verifier implementation.

at line 1011
protected PresenceVerifierInterface getPresenceVerifierFor(string $connection)

Get the Presence Verifier implementation.

Parameters

string $connection

Return Value

PresenceVerifierInterface

Exceptions

RuntimeException

at line 1024
void setPresenceVerifier(PresenceVerifierInterface $presenceVerifier)

Set the Presence Verifier implementation.

Parameters

PresenceVerifierInterface $presenceVerifier

Return Value

void

at line 1034
Translator getTranslator()

Get the Translator implementation.

Return Value

Translator

at line 1045
void setTranslator(Translator $translator)

Set the Translator implementation.

Parameters

Translator $translator

Return Value

void

at line 1056
void setContainer(Container $container)

Set the IoC container instance.

Parameters

Container $container

Return Value

void

at line 1068
protected bool|null callExtension(string $rule, array $parameters)

Call a custom validator extension.

Parameters

string $rule
array $parameters

Return Value

bool|null

at line 1086
protected bool callClassBasedExtension(string $callback, array $parameters)

Call a class based validator extension.

Parameters

string $callback
array $parameters

Return Value

bool

at line 1102
mixed __call(string $method, array $parameters)

Handle dynamic calls to class methods.

Parameters

string $method
array $parameters

Return Value

mixed

Exceptions

BadMethodCallException