Validator
class Validator implements Validator (View source)
Methods
Create a new Validator instance.
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.
Get the array of custom validator extensions.
Register an array of custom validator extensions.
Register an array of custom implicit validator extensions.
Register a custom implicit validator extension.
Get the array of custom validator message replacers.
Register an array of custom validator message replacers.
Get the data under validation.
Set the data under validation.
Get the validation rules.
Set the validation rules.
Set the custom attributes on the validator.
Set the custom values on the validator.
Get the files under validation.
Set the files under validation.
Get the Presence Verifier implementation.
Set the Presence Verifier implementation.
Get the Translator implementation.
Set the Translator implementation.
Get the custom messages for the validator.
Set the custom messages for the validator.
Get the custom attributes used by the validator.
Add custom attributes to the validator.
Get the custom values for the validator.
Add the custom values for the validator.
Get the fallback messages for the validator.
Set the fallback messages for the validator.
Get the failed validation rules.
Get the message container for the validator.
An alternative more semantic shortcut to the message container.
Get the messages for the instance.
Handle dynamic calls to class methods.
Details
at line line 190
void
__construct(
TranslatorInterface $translator,
array $data,
array $rules,
array $messages = array(),
array $customAttributes = array())
Create a new Validator instance.
at line line 276
void
sometimes(
string $attribute,
string|array $rules,
callable $callback)
Add conditions to a given field based on a Closure.
at line line 300
void
each(
string $attribute,
string|array $rules)
Define a set of rules that apply to each element in an array attribute.
at line line 349
array
extractValuesForWildcards(
array $data,
string $attribute)
Get all of the exact attribute values for a given wildcard attribute.
at line line 379
$this
mergeRules(
string $attribute,
string|array $rules = array())
Merge additional rules into a given attribute(s).
at line line 1447
string
guessColumnForQuery(
string $attribute)
Guess the database column from the given attribute name.
at line line 1586
bool
isAValidFileInstance(
mixed $value)
Check that the given value is a valid file instance.
at line line 2117
string
getDisplayableValue(
string $attribute,
mixed $value)
Get the displayable name of the value.
at line line 2697
void
addExtensions(
array $extensions)
Register an array of custom validator extensions.
at line line 2714
void
addImplicitExtensions(
array $extensions)
Register an array of custom implicit validator extensions.
at line line 2730
void
addExtension(
string $rule,
Closure|string $extension)
Register a custom validator extension.
at line line 2742
void
addImplicitExtension(
string $rule,
Closure|string $extension)
Register a custom implicit validator extension.
at line line 2765
void
addReplacers(
array $replacers)
Register an array of custom validator message replacers.
at line line 2783
void
addReplacer(
string $rule,
Closure|string $replacer)
Register a custom validator message replacer.
at line line 2848
$this
setAttributeNames(
array $attributes)
Set the custom attributes on the validator.
at line line 2898
PresenceVerifierInterface
getPresenceVerifier()
Get the Presence Verifier implementation.
at line line 2913
void
setPresenceVerifier(
PresenceVerifierInterface $presenceVerifier)
Set the Presence Verifier implementation.
at line line 2934
void
setTranslator(
TranslatorInterface $translator)
Set the Translator implementation.
at line line 2955
void
setCustomMessages(
array $messages)
Set the custom messages for the validator.
at line line 2976
$this
addCustomAttributes(
array $customAttributes)
Add custom attributes to the validator.
at line line 2999
$this
addCustomValues(
array $customValues)
Add the custom values for the validator.
at line line 3022
void
setFallbackMessages(
array $messages)
Set the fallback messages for the validator.
at line line 3056
MessageBag
errors()
An alternative more semantic shortcut to the message container.
at line line 3177
mixed
__call(
string $method,
array $parameters)
Handle dynamic calls to class methods.