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.
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 1433
string
guessColumnForQuery(
string $attribute)
Guess the database column from the given attribute name.
at line line 1572
bool
isAValidFileInstance(
mixed $value)
Check that the given value is a valid file instance.
at line line 2103
string
getDisplayableValue(
string $attribute,
mixed $value)
Get the displayable name of the value.
at line line 2683
void
addExtensions(
array $extensions)
Register an array of custom validator extensions.
at line line 2700
void
addImplicitExtensions(
array $extensions)
Register an array of custom implicit validator extensions.
at line line 2716
void
addExtension(
string $rule,
Closure|string $extension)
Register a custom validator extension.
at line line 2728
void
addImplicitExtension(
string $rule,
Closure|string $extension)
Register a custom implicit validator extension.
at line line 2751
void
addReplacers(
array $replacers)
Register an array of custom validator message replacers.
at line line 2769
void
addReplacer(
string $rule,
Closure|string $replacer)
Register a custom validator message replacer.
at line line 2834
$this
setAttributeNames(
array $attributes)
Set the custom attributes on the validator.
at line line 2884
PresenceVerifierInterface
getPresenceVerifier()
Get the Presence Verifier implementation.
at line line 2899
void
setPresenceVerifier(
PresenceVerifierInterface $presenceVerifier)
Set the Presence Verifier implementation.
at line line 2920
void
setTranslator(
TranslatorInterface $translator)
Set the Translator implementation.
at line line 2941
void
setCustomMessages(
array $messages)
Set the custom messages for the validator.
at line line 2962
$this
addCustomAttributes(
array $customAttributes)
Add custom attributes to the validator.
at line line 2985
$this
addCustomValues(
array $customValues)
Add the custom values for the validator.
at line line 3008
void
setFallbackMessages(
array $messages)
Set the fallback messages for the validator.
at line line 3042
MessageBag
errors()
An alternative more semantic shortcut to the message container.
at line line 3163
mixed
__call(
string $method,
array $parameters)
Handle dynamic calls to class methods.