On this page
Factory
class Factory implements Factory (View source)
Properties
protected Translator | $translator | The Translator implementation. |
|
protected PresenceVerifierInterface | $verifier | The Presence Verifier implementation. |
|
protected Container|null | $container | The IoC container instance. |
|
protected Closure|string> | $extensions | All of the custom validator extensions. |
|
protected Closure|string> | $implicitExtensions | All of the custom implicit validator extensions. |
|
protected Closure|string> | $dependentExtensions | All of the custom dependent validator extensions. |
|
protected Closure|string> | $replacers | All of the custom validator message replacers. |
|
protected array<string,string> | $fallbackMessages | All of the fallback messages for custom rules. |
|
protected bool | $excludeUnvalidatedArrayKeys | Indicates that unvalidated array keys should be excluded, even if the parent array was validated. |
|
protected Closure | $resolver | The Validator resolver instance. |
Methods
void | __construct(Translator $translator, Container $container = null) Create a new Validator factory instance. |
|
Validator | make(array $data, array $rules, array $messages = [], array $attributes = []) Create a new Validator instance. |
|
array | validate(array $data, array $rules, array $messages = [], array $attributes = []) Validate the given data against the provided rules. |
|
Validator | resolve(array $data, array $rules, array $messages, array $attributes) Resolve a new Validator instance. |
|
void | addExtensions(Validator $validator) Add the extensions to a validator instance. |
|
void | extend(string $rule, Closure|string $extension, string|null $message = null) Register a custom validator extension. |
|
void | extendImplicit(string $rule, Closure|string $extension, string|null $message = null) Register a custom implicit validator extension. |
|
void | extendDependent(string $rule, Closure|string $extension, string|null $message = null) Register a custom dependent validator extension. |
|
void | replacer(string $rule, Closure|string $replacer) Register a custom validator message replacer. |
|
void | includeUnvalidatedArrayKeys() Indicate that unvalidated array keys should be included in validated data when the parent array is validated. |
|
void | excludeUnvalidatedArrayKeys() Indicate that unvalidated array keys should be excluded from the validated data, even if the parent array was validated. |
|
void | resolver(Closure $resolver) Set the Validator instance resolver. |
|
Translator | getTranslator() Get the Translator implementation. |
|
PresenceVerifierInterface | getPresenceVerifier() Get the Presence Verifier implementation. |
|
void | setPresenceVerifier(PresenceVerifierInterface $presenceVerifier) Set the Presence Verifier implementation. |
|
Container|null | getContainer() Get the container instance used by the validation factory. |
|
$this | setContainer(Container $container) Set the container instance used by the validation factory. |
Details
void __construct(Translator $translator, Container $container = null)
Create a new Validator factory instance.
Validator make(array $data, array $rules, array $messages = [], array $attributes = [])
Create a new Validator instance.
array validate(array $data, array $rules, array $messages = [], array $attributes = [])
Validate the given data against the provided rules.
protected Validator resolve(array $data, array $rules, array $messages, array $attributes)
Resolve a new Validator instance.
protected void addExtensions(Validator $validator)
Add the extensions to a validator instance.
void extend(string $rule, Closure|string $extension, string|null $message = null)
Register a custom validator extension.
void extendImplicit(string $rule, Closure|string $extension, string|null $message = null)
Register a custom implicit validator extension.
void extendDependent(string $rule, Closure|string $extension, string|null $message = null)
Register a custom dependent validator extension.
void replacer(string $rule, Closure|string $replacer)
Register a custom validator message replacer.
void includeUnvalidatedArrayKeys()
Indicate that unvalidated array keys should be included in validated data when the parent array is validated.
void excludeUnvalidatedArrayKeys()
Indicate that unvalidated array keys should be excluded from the validated data, even if the parent array was validated.
void resolver(Closure $resolver)
Set the Validator instance resolver.
Translator getTranslator()
Get the Translator implementation.
PresenceVerifierInterface getPresenceVerifier()
Get the Presence Verifier implementation.
void setPresenceVerifier(PresenceVerifierInterface $presenceVerifier)
Set the Presence Verifier implementation.
Container|null getContainer()
Get the container instance used by the validation factory.
$this setContainer(Container $container)
Set the container instance used by the validation factory.
© Taylor Otwell
Licensed under the MIT License.
Laravel is a trademark of Taylor Otwell.
https://laravel.com/api/10.x/Illuminate/Validation/Factory.html