class Validator implements Validator (View source)
void | __construct(TranslatorInterface $translator, array $data, array $rules, array $messages = array(), array $customAttributes = array()) Create a new Validator instance. | |
array | parseData(array $data) Parse the data array. | |
$this | after(callable|string $callback) After an after validation callback. | |
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. | |
array | extractValuesForWildcards(array $data, string $attribute) Get all of the exact attribute values for a given wildcard attribute. | |
$this | mergeRules(string $attribute, string|array $rules = array()) Merge additional rules into a given attribute(s). | |
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. | |
array | valid() Returns the data which was valid. | |
array | invalid() Returns the data which was invalid. | |
string | guessColumnForQuery(string $attribute) Guess the database column from the given attribute name. | |
bool | isAValidFileInstance(mixed $value) Check that the given value is a valid file instance. | |
string | getDisplayableValue(string $attribute, mixed $value) Get the displayable name of the value. | |
array | attributes() Get all attributes. | |
bool | hasAttribute(string $attribute) Checks if an attribute exists. | |
bool | hasRule(string $attribute, string|array $rules) Determine if the given attribute has a rule in the given set. | |
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. | |
$this | 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. | |
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. | |
mixed | __call(string $method, array $parameters) Handle dynamic calls to class methods. |
Create a new Validator instance.
Parse the data array.
After an after validation callback.
Add conditions to a given field based on a Closure.
Define a set of rules that apply to each element in an array attribute.
Get all of the exact attribute values for a given wildcard attribute.
Merge additional rules into a given attribute(s).
Determine if the data passes the validation rules.
Determine if the data fails the validation rules.
Run the validator's rules against its data.
Returns the data which was valid.
Returns the data which was invalid.
Guess the database column from the given attribute name.
Check that the given value is a valid file instance.
Get the displayable name of the value.
Get all attributes.
Checks if an attribute exists.
Determine if the given attribute has a rule in the given set.
Get the array of custom validator extensions.
Register an array of custom validator extensions.
Register an array of custom implicit validator extensions.
Register a custom validator extension.
Register a custom implicit validator extension.
Get the array of custom validator message replacers.
Register an array of custom validator message replacers.
Register a custom validator message replacer.
Get the data under validation.
Set the data under validation.
Get the validation rules.
Set the validation rules.
Set the custom attributes on the validator.
Set the custom values on the validator.
Get the Presence Verifier implementation.
Set the Presence Verifier implementation.
Get the Translator implementation.
Set the Translator implementation.
Get the custom messages for the validator.
Set the custom messages for the validator.
Get the custom attributes used by the validator.
Add custom attributes to the validator.
Get the custom values for the validator.
Add the custom values for the validator.
Get the fallback messages for the validator.
Set the fallback messages for the validator.
Get the failed validation rules.
Get the message container for the validator.
An alternative more semantic shortcut to the message container.
Get the messages for the instance.
Set the IoC container instance.
Handle dynamic calls to class methods.
© Taylor Otwell
Licensed under the MIT License.
Laravel is a trademark of Taylor Otwell.
https://laravel.com/api/5.3/Illuminate/Validation/Validator.html