Validator
class Validator implements MessageProviderInterface (View source)
Properties
protected TranslatorInterface | $translator | The Translator implementation. | |
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 | $files | The files under validation. | |
protected array | $rules | The rules to be applied to the data. | |
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 displayabled 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. |
Methods
void | __construct(TranslatorInterface $translator, array $data, array $rules, array $messages = array(), array $customAttributes = array()) Create a new Validator instance. | |
array | parseData(array $data, string $arrayKey = null) Parse the data and hydrate the files array. | |
array | explodeRules(string|array $rules) Explode the rules into an array of rules. | |
void | sometimes(string $attribute, string|array $rules, callable $callback) Add conditions to a given field based on a Closure. | |
void | each(string $attribute, string|array $rules) Define a set of rules that apply to each element in an array attribute. | |
void | mergeRules(string $attribute, string|array $rules) Merge additional rules into a given attribute. | |
bool | passes() Determine if the data passes the validation rules. | |
bool | fails() Determine if the data fails the validation rules. | |
void | validate(string $attribute, string $rule) Validate a given attribute against a rule. | |
array | valid() Returns the data which was valid. | |
array | invalid() Returns the data which was invalid. | |
mixed | getValue(string $attribute) Get the value of a given attribute. | |
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 | passesOptionalCheck(string $attribute) Determine if the attribute passes any optional check. | |
bool | isImplicit(string $rule) Determine if a given rule implies the attribute is required. | |
bool | hasNotFailedPreviousRuleIfPresenceRule(string $rule, string $attribute) Determine if it's a necessary presence validation. | |
void | addFailure(string $attribute, string $rule, array $parameters) Add a failed rule and error message to the collection. | |
void | addError(string $attribute, string $rule, array $parameters) Add an error message to the validator's collection of messages. | |
bool | validateSometimes() "Validate" optional attributes. | |
bool | validateRequired(string $attribute, mixed $value) Validate that a required attribute exists. | |
bool | validateFilled(string $attribute, mixed $value) Validate the given attribute is filled if it is present. | |
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 | 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 | validateRequiredIf(string $attribute, mixed $value, mixed $parameters) Validate that an attribute exists when another attribute has a given value. | |
int | getPresentCount(array $attributes) Get the number of attributes in a list that are present. | |
bool | validateConfirmed(string $attribute, mixed $value) Validate that an attribute has a matching confirmation. | |
bool | validateSame(string $attribute, mixed $value, array $parameters) Validate that two attributes match. | |
bool | validateDifferent(string $attribute, mixed $value, array $parameters) Validate that an attribute is different from another attribute. | |
bool | validateAccepted(string $attribute, mixed $value) Validate that an attribute was "accepted". | |
bool | validateArray(string $attribute, mixed $value) Validate that an attribute is an array. | |
bool | validateBoolean(string $attribute, mixed $value) Validate that an attribute is a boolean. | |
bool | validateInteger(string $attribute, mixed $value) Validate that an attribute is an integer. | |
bool | validateNumeric(string $attribute, mixed $value) Validate that an attribute is numeric. | |
bool | validateString(string $attribute, mixed $value) Validate that an attribute is a string. | |
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 | validateSize(string $attribute, mixed $value, array $parameters) Validate the size of an attribute. | |
bool | validateBetween(string $attribute, mixed $value, array $parameters) Validate the size of an attribute is between a set of values. | |
bool | validateMin(string $attribute, mixed $value, array $parameters) Validate the size of an attribute is greater than a minimum value. | |
bool | validateMax(string $attribute, mixed $value, array $parameters) Validate the size of an attribute is less than a maximum value. | |
mixed | getSize(string $attribute, mixed $value) Get the size of an attribute. | |
int | getStringSize(string $value) Get the size of a string. | |
bool | validateIn(string $attribute, mixed $value, array $parameters) Validate an attribute is contained within a list of values. | |
bool | validateNotIn(string $attribute, mixed $value, array $parameters) Validate an attribute is not contained within a list of values. | |
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. | |
array | getUniqueExtra(array $parameters) Get the extra conditions for a unique rule. | |
bool | validateExists(string $attribute, mixed $value, array $parameters) Validate the existence of an attribute value in a database table. | |
int | getExistCount(string $table, string $column, mixed $value, array $parameters) Get the number of records that exist in storage. | |
array | getExtraExistConditions(array $parameters) Get the extra exist conditions. | |
array | getExtraConditions(array $segments) Get the extra conditions for a unique / exists rule. | |
bool | validateIp(string $attribute, mixed $value) Validate that an attribute is a valid IP. | |
bool | validateEmail(string $attribute, mixed $value) Validate that an attribute is a valid e-mail address. | |
bool | validateUrl(string $attribute, mixed $value) Validate that an attribute is a valid URL. | |
bool | validateActiveUrl(string $attribute, mixed $value) Validate that an attribute is an active URL. | |
bool | validateImage(string $attribute, mixed $value) Validate the MIME type of a file is an image MIME type. | |
bool | validateMimes(string $attribute, mixed $value, array $parameters) Validate the MIME type of a file upload attribute is in a set of MIME types. | |
bool | isAValidFileInstance(mixed $value) Check that the given value is a valid file instance. | |
bool | validateAlpha(string $attribute, mixed $value) Validate that an attribute contains only alphabetic characters. | |
bool | validateAlphaNum(string $attribute, mixed $value) Validate that an attribute contains only alpha-numeric characters. | |
bool | validateAlphaDash(string $attribute, mixed $value) Validate that an attribute contains only alpha-numeric characters, dashes, and underscores. | |
bool | validateRegex(string $attribute, mixed $value, array $parameters) Validate that an attribute passes a regular expression check. | |
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 | validateBefore(string $attribute, mixed $value, array $parameters) Validate the date is before a given date. | |
bool | validateBeforeWithFormat(string $format, mixed $value, array $parameters) Validate the date is before a given date with a given format. | |
bool | validateAfter(string $attribute, mixed $value, array $parameters) Validate the date is after a given date. | |
bool | validateAfterWithFormat(string $format, mixed $value, array $parameters) Validate the date is after a given date with a given format. | |
bool | checkDateTimeOrder(string $format, string $before, string $after) 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 | validateTimezone(string $attribute, mixed $value) Validate that an attribute is a valid timezone. | |
string|null | getDateFormat(string $attribute) Get the date format for an attribute if it has one. | |
string | getMessage(string $attribute, string $rule) Get the validation message for an attribute and rule. | |
string | getInlineMessage(string $attribute, string $lowerRule, array $source = null) Get the inline message for a rule if it exists. | |
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 | doReplacements(string $message, string $attribute, string $rule, array $parameters) Replace all error message place-holders with actual values. | |
array | getAttributeList(array $values) Transform an array of attributes to their displayable form. | |
string | getAttribute(string $attribute) Get the displayable name of the attribute. | |
string | getDisplayableValue(string $attribute, mixed $value) Get the displayable name of the value. | |
string | replaceBetween(string $message, string $attribute, string $rule, array $parameters) Replace all place-holders for the between 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 | replaceSize(string $message, string $attribute, string $rule, array $parameters) Replace all place-holders for the size 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 | 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 | 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 | replaceRequiredIf(string $message, string $attribute, string $rule, array $parameters) Replace all place-holders for the required_if rule. | |
string | replaceSame(string $message, string $attribute, string $rule, array $parameters) Replace all place-holders for the same rule. | |
string | replaceDifferent(string $message, string $attribute, string $rule, array $parameters) Replace all place-holders for the different rule. | |
string | replaceDateFormat(string $message, string $attribute, string $rule, array $parameters) Replace all place-holders for the date_format rule. | |
string | replaceBefore(string $message, string $attribute, string $rule, array $parameters) Replace all place-holders for the before rule. | |
string | replaceAfter(string $message, string $attribute, string $rule, array $parameters) Replace all place-holders for the after rule. | |
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 | parseRule(array|string $rules) Extract the rule name and parameters from a rule. | |
array | parseArrayRule(array $rules) Parse an array based rule. | |
array | parseStringRule(string $rules) Parse a string based rule. | |
array | parseParameters(string $rule, string $parameter) Parse a parameter list. | |
array | getExtensions() Get the array of custom validator extensions. | |
void | addExtensions(array $extensions) Register an array of custom validator extensions. | |
void | addImplicitExtensions(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. | |
array | getReplacers() Get the array of custom validator message replacers. | |
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. | |
array | getData() Get the data under validation. | |
void | setData(array $data) Set the data under validation. | |
array | getRules() Get the validation rules. | |
$this | setRules(array $rules) Set the validation rules. | |
$this | setAttributeNames(array $attributes) Set the custom attributes on the validator. | |
$this | setValueNames(array $values) Set the custom values on the validator. | |
array | getFiles() Get the files under validation. | |
$this | setFiles(array $files) Set the files under validation. | |
PresenceVerifierInterface | getPresenceVerifier() Get the Presence Verifier implementation. | |
void | setPresenceVerifier(PresenceVerifierInterface $presenceVerifier) Set the Presence Verifier implementation. | |
TranslatorInterface | getTranslator() Get the Translator implementation. | |
void | setTranslator(TranslatorInterface $translator) Set the Translator implementation. | |
array | getCustomMessages() Get the custom messages for the validator | |
void | setCustomMessages(array $messages) Set the custom messages for the validator | |
array | getCustomAttributes() Get the custom attributes used by the validator. | |
$this | addCustomAttributes(array $customAttributes) Add custom attributes to the validator. | |
array | getCustomValues() Get the custom values for the validator. | |
$this | addCustomValues(array $customValues) Add the custom values for the validator. | |
array | getFallbackMessages() Get the fallback messages for the validator. | |
void | setFallbackMessages(array $messages) Set the fallback messages for the validator. | |
array | failed() Get the failed validation rules. | |
MessageBag | messages() Get the message container for the validator. | |
MessageBag | errors() An alternative more semantic shortcut to the message container. | |
MessageBag | getMessageBag() Get the messages for the instance. | |
void | setContainer(Container $container) Set the IoC container instance. | |
bool | callExtension(string $rule, array $parameters) Call a custom validator extension. | |
bool | callClassBasedExtension(string $callback, array $parameters) Call a class based validator extension. | |
string | callReplacer(string $message, string $attribute, string $rule, array $parameters) Call a custom validator message replacer. | |
string | callClassBasedReplacer(string $callback, string $message, string $attribute, string $rule, array $parameters) Call a class based validator message replacer. | |
void | requireParameterCount(int $count, array $parameters, string $rule) Require a certain number of parameters to be present. | |
mixed | __call(string $method, array $parameters) Handle dynamic calls to class methods. |
Details
void __construct(TranslatorInterface $translator, array $data, array $rules, array $messages = array(), array $customAttributes = array())
Create a new Validator instance.
protected array parseData(array $data, string $arrayKey = null)
Parse the data and hydrate the files array.
protected array explodeRules(string|array $rules)
Explode the rules into an array of rules.
void sometimes(string $attribute, string|array $rules, callable $callback)
Add conditions to a given field based on a Closure.
void each(string $attribute, string|array $rules)
Define a set of rules that apply to each element in an array attribute.
void mergeRules(string $attribute, string|array $rules)
Merge additional rules into a given attribute.
bool passes()
Determine if the data passes the validation rules.
bool fails()
Determine if the data fails the validation rules.
protected void validate(string $attribute, string $rule)
Validate a given attribute against a rule.
array valid()
Returns the data which was valid.
array invalid()
Returns the data which was invalid.
protected mixed getValue(string $attribute)
Get the value of a given attribute.
protected bool isValidatable(string $rule, string $attribute, mixed $value)
Determine if the attribute is validatable.
protected bool presentOrRuleIsImplicit(string $rule, string $attribute, mixed $value)
Determine if the field is present, or the rule implies required.
protected bool passesOptionalCheck(string $attribute)
Determine if the attribute passes any optional check.
protected bool isImplicit(string $rule)
Determine if a given rule implies the attribute is required.
protected bool hasNotFailedPreviousRuleIfPresenceRule(string $rule, string $attribute)
Determine if it's a necessary presence validation.
This is to avoid possible database type comparison errors.
protected void addFailure(string $attribute, string $rule, array $parameters)
Add a failed rule and error message to the collection.
protected void addError(string $attribute, string $rule, array $parameters)
Add an error message to the validator's collection of messages.
protected bool validateSometimes()
"Validate" optional attributes.
Always returns true, just lets us put sometimes in rules.
protected bool validateRequired(string $attribute, mixed $value)
Validate that a required attribute exists.
protected bool validateFilled(string $attribute, mixed $value)
Validate the given attribute is filled if it is present.
protected bool anyFailingRequired(array $attributes)
Determine if any of the given attributes fail the required test.
protected bool allFailingRequired(array $attributes)
Determine if all of the given attributes fail the required test.
protected bool validateRequiredWith(string $attribute, mixed $value, mixed $parameters)
Validate that an attribute exists when any other attribute exists.
protected bool validateRequiredWithAll(string $attribute, mixed $value, mixed $parameters)
Validate that an attribute exists when all other attributes exists.
protected bool validateRequiredWithout(string $attribute, mixed $value, mixed $parameters)
Validate that an attribute exists when another attribute does not.
protected bool validateRequiredWithoutAll(string $attribute, mixed $value, mixed $parameters)
Validate that an attribute exists when all other attributes do not.
protected bool validateRequiredIf(string $attribute, mixed $value, mixed $parameters)
Validate that an attribute exists when another attribute has a given value.
protected int getPresentCount(array $attributes)
Get the number of attributes in a list that are present.
protected bool validateConfirmed(string $attribute, mixed $value)
Validate that an attribute has a matching confirmation.
protected bool validateSame(string $attribute, mixed $value, array $parameters)
Validate that two attributes match.
protected bool validateDifferent(string $attribute, mixed $value, array $parameters)
Validate that an attribute is different from another attribute.
protected bool validateAccepted(string $attribute, mixed $value)
Validate that an attribute was "accepted".
This validation rule implies the attribute is "required".
protected bool validateArray(string $attribute, mixed $value)
Validate that an attribute is an array.
protected bool validateBoolean(string $attribute, mixed $value)
Validate that an attribute is a boolean.
protected bool validateInteger(string $attribute, mixed $value)
Validate that an attribute is an integer.
protected bool validateNumeric(string $attribute, mixed $value)
Validate that an attribute is numeric.
protected bool validateString(string $attribute, mixed $value)
Validate that an attribute is a string.
protected bool validateDigits(string $attribute, mixed $value, array $parameters)
Validate that an attribute has a given number of digits.
protected bool validateDigitsBetween(string $attribute, mixed $value, array $parameters)
Validate that an attribute is between a given number of digits.
protected bool validateSize(string $attribute, mixed $value, array $parameters)
Validate the size of an attribute.
protected bool validateBetween(string $attribute, mixed $value, array $parameters)
Validate the size of an attribute is between a set of values.
protected bool validateMin(string $attribute, mixed $value, array $parameters)
Validate the size of an attribute is greater than a minimum value.
protected bool validateMax(string $attribute, mixed $value, array $parameters)
Validate the size of an attribute is less than a maximum value.
protected mixed getSize(string $attribute, mixed $value)
Get the size of an attribute.
protected int getStringSize(string $value)
Get the size of a string.
protected bool validateIn(string $attribute, mixed $value, array $parameters)
Validate an attribute is contained within a list of values.
protected bool validateNotIn(string $attribute, mixed $value, array $parameters)
Validate an attribute is not contained within a list of values.
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.
protected array getUniqueIds(array $parameters)
Get the excluded ID column and value for the unique rule.
protected array getUniqueExtra(array $parameters)
Get the extra conditions for a unique rule.
protected bool validateExists(string $attribute, mixed $value, array $parameters)
Validate the existence of an attribute value in a database table.
protected int getExistCount(string $table, string $column, mixed $value, array $parameters)
Get the number of records that exist in storage.
protected array getExtraExistConditions(array $parameters)
Get the extra exist conditions.
protected array getExtraConditions(array $segments)
Get the extra conditions for a unique / exists rule.
protected bool validateIp(string $attribute, mixed $value)
Validate that an attribute is a valid IP.
protected bool validateEmail(string $attribute, mixed $value)
Validate that an attribute is a valid e-mail address.
protected bool validateUrl(string $attribute, mixed $value)
Validate that an attribute is a valid URL.
protected bool validateActiveUrl(string $attribute, mixed $value)
Validate that an attribute is an active URL.
protected bool validateImage(string $attribute, mixed $value)
Validate the MIME type of a file is an image MIME type.
protected bool validateMimes(string $attribute, mixed $value, array $parameters)
Validate the MIME type of a file upload attribute is in a set of MIME types.
protected bool isAValidFileInstance(mixed $value)
Check that the given value is a valid file instance.
protected bool validateAlpha(string $attribute, mixed $value)
Validate that an attribute contains only alphabetic characters.
protected bool validateAlphaNum(string $attribute, mixed $value)
Validate that an attribute contains only alpha-numeric characters.
protected bool validateAlphaDash(string $attribute, mixed $value)
Validate that an attribute contains only alpha-numeric characters, dashes, and underscores.
protected bool validateRegex(string $attribute, mixed $value, array $parameters)
Validate that an attribute passes a regular expression check.
protected bool validateDate(string $attribute, mixed $value)
Validate that an attribute is a valid date.
protected bool validateDateFormat(string $attribute, mixed $value, array $parameters)
Validate that an attribute matches a date format.
protected bool validateBefore(string $attribute, mixed $value, array $parameters)
Validate the date is before a given date.
protected bool validateBeforeWithFormat(string $format, mixed $value, array $parameters)
Validate the date is before a given date with a given format.
protected bool validateAfter(string $attribute, mixed $value, array $parameters)
Validate the date is after a given date.
protected bool validateAfterWithFormat(string $format, mixed $value, array $parameters)
Validate the date is after a given date with a given format.
protected bool checkDateTimeOrder(string $format, string $before, string $after)
Given two date/time strings, check that one is after the other.
protected DateTime|null getDateTimeWithOptionalFormat(string $format, string $value)
Get a DateTime instance from a string.
protected bool validateTimezone(string $attribute, mixed $value)
Validate that an attribute is a valid timezone.
protected string|null getDateFormat(string $attribute)
Get the date format for an attribute if it has one.
protected string getMessage(string $attribute, string $rule)
Get the validation message for an attribute and rule.
protected string getInlineMessage(string $attribute, string $lowerRule, array $source = null)
Get the inline message for a rule if it exists.
protected string getSizeMessage(string $attribute, string $rule)
Get the proper error message for an attribute and size rule.
protected string getAttributeType(string $attribute)
Get the data type of the given attribute.
protected string doReplacements(string $message, string $attribute, string $rule, array $parameters)
Replace all error message place-holders with actual values.
protected array getAttributeList(array $values)
Transform an array of attributes to their displayable form.
protected string getAttribute(string $attribute)
Get the displayable name of the attribute.
string getDisplayableValue(string $attribute, mixed $value)
Get the displayable name of the value.
protected string replaceBetween(string $message, string $attribute, string $rule, array $parameters)
Replace all place-holders for the between rule.
protected string replaceDigits(string $message, string $attribute, string $rule, array $parameters)
Replace all place-holders for the digits rule.
protected string replaceDigitsBetween(string $message, string $attribute, string $rule, array $parameters)
Replace all place-holders for the digits (between) rule.
protected string replaceSize(string $message, string $attribute, string $rule, array $parameters)
Replace all place-holders for the size rule.
protected string replaceMin(string $message, string $attribute, string $rule, array $parameters)
Replace all place-holders for the min rule.
protected string replaceMax(string $message, string $attribute, string $rule, array $parameters)
Replace all place-holders for the max rule.
protected string replaceIn(string $message, string $attribute, string $rule, array $parameters)
Replace all place-holders for the in rule.
protected string replaceNotIn(string $message, string $attribute, string $rule, array $parameters)
Replace all place-holders for the not_in rule.
protected string replaceMimes(string $message, string $attribute, string $rule, array $parameters)
Replace all place-holders for the mimes rule.
protected string replaceRequiredWith(string $message, string $attribute, string $rule, array $parameters)
Replace all place-holders for the required_with rule.
protected string replaceRequiredWithout(string $message, string $attribute, string $rule, array $parameters)
Replace all place-holders for the required_without rule.
protected string replaceRequiredWithoutAll(string $message, string $attribute, string $rule, array $parameters)
Replace all place-holders for the required_without_all rule.
protected string replaceRequiredIf(string $message, string $attribute, string $rule, array $parameters)
Replace all place-holders for the required_if rule.
protected string replaceSame(string $message, string $attribute, string $rule, array $parameters)
Replace all place-holders for the same rule.
protected string replaceDifferent(string $message, string $attribute, string $rule, array $parameters)
Replace all place-holders for the different rule.
protected string replaceDateFormat(string $message, string $attribute, string $rule, array $parameters)
Replace all place-holders for the date_format rule.
protected string replaceBefore(string $message, string $attribute, string $rule, array $parameters)
Replace all place-holders for the before rule.
protected string replaceAfter(string $message, string $attribute, string $rule, array $parameters)
Replace all place-holders for the after rule.
protected bool hasRule(string $attribute, string|array $rules)
Determine if the given attribute has a rule in the given set.
protected array|null getRule(string $attribute, string|array $rules)
Get a rule and its parameters for a given attribute.
protected array parseRule(array|string $rules)
Extract the rule name and parameters from a rule.
protected array parseArrayRule(array $rules)
Parse an array based rule.
protected array parseStringRule(string $rules)
Parse a string based rule.
protected array parseParameters(string $rule, string $parameter)
Parse a parameter list.
array getExtensions()
Get the array of custom validator extensions.
void addExtensions(array $extensions)
Register an array of custom validator extensions.
void addImplicitExtensions(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.
array getReplacers()
Get the array of custom validator message replacers.
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.
array getData()
Get the data under validation.
void setData(array $data)
Set the data under validation.
array getRules()
Get the validation rules.
$this setRules(array $rules)
Set the validation rules.
$this setAttributeNames(array $attributes)
Set the custom attributes on the validator.
$this setValueNames(array $values)
Set the custom values on the validator.
array getFiles()
Get the files under validation.
$this setFiles(array $files)
Set the files under validation.
PresenceVerifierInterface getPresenceVerifier()
Get the Presence Verifier implementation.
void setPresenceVerifier(PresenceVerifierInterface $presenceVerifier)
Set the Presence Verifier implementation.
TranslatorInterface getTranslator()
Get the Translator implementation.
void setTranslator(TranslatorInterface $translator)
Set the Translator implementation.
array getCustomMessages()
Get the custom messages for the validator
void setCustomMessages(array $messages)
Set the custom messages for the validator
array getCustomAttributes()
Get the custom attributes used by the validator.
$this addCustomAttributes(array $customAttributes)
Add custom attributes to the validator.
array getCustomValues()
Get the custom values for the validator.
$this addCustomValues(array $customValues)
Add the custom values for the validator.
array getFallbackMessages()
Get the fallback messages for the validator.
void setFallbackMessages(array $messages)
Set the fallback messages for the validator.
array failed()
Get the failed validation rules.
MessageBag messages()
Get the message container for the validator.
MessageBag errors()
An alternative more semantic shortcut to the message container.
MessageBag getMessageBag()
Get the messages for the instance.
void setContainer(Container $container)
Set the IoC container instance.
protected bool callExtension(string $rule, array $parameters)
Call a custom validator extension.
protected bool callClassBasedExtension(string $callback, array $parameters)
Call a class based validator extension.
protected string callReplacer(string $message, string $attribute, string $rule, array $parameters)
Call a custom validator message replacer.
protected string callClassBasedReplacer(string $callback, string $message, string $attribute, string $rule, array $parameters)
Call a class based validator message replacer.
protected void requireParameterCount(int $count, array $parameters, string $rule)
Require a certain number of parameters to be present.
mixed __call(string $method, array $parameters)
Handle dynamic calls to class methods.
© Taylor Otwell
Licensed under the MIT License.
Laravel is a trademark of Taylor Otwell.
https://laravel.com/api/4.2/Illuminate/Validation/Validator.html