Validator.php
TLDR
This file is a part of the Demo Projects project and contains the Validator
class. This class extends the Facade
class and provides static methods for validating data.
Classes
Validator
The Validator
class is a facade for the validation service in Laravel. It extends the Facade
class and provides static methods for validating data. The class has the following methods:
-
make(array $data, array $rules, array $messages = [], array $attributes = [])
: Creates a new validator instance for the given data and rules. -
validate(array $data, array $rules, array $messages = [], array $attributes = [])
: Validates the given data against the specified rules. -
extend(string $rule, \Closure|string $extension, string|null $message = null)
: Extends the validator with a custom rule and message using a closure or a class method. -
extendImplicit(string $rule, \Closure|string $extension, string|null $message = null)
: Extends the validator with a custom implicit rule and message using a closure or a class method. -
extendDependent(string $rule, \Closure|string $extension, string|null $message = null)
: Extends the validator with a custom dependent rule and message using a closure or a class method. -
replacer(string $rule, \Closure|string $replacer)
: Registers a custom error message replacer for a rule. -
includeUnvalidatedArrayKeys()
: Specifies that unvalidated array keys should be included in the validation results. -
excludeUnvalidatedArrayKeys()
: Specifies that unvalidated array keys should be excluded from the validation results. -
resolver(\Closure $resolver)
: Sets a custom validation resolver for creating validators. -
getTranslator()
: Returns the current translator instance used by the validator. -
getPresenceVerifier()
: Returns the presence verifier implementation. -
setPresenceVerifier(\Illuminate\Validation\PresenceVerifierInterface $presenceVerifier)
: Sets the presence verifier implementation. -
getContainer()
: Returns the current container instance. -
setContainer(\Illuminate\Contracts\Container\Container $container)
: Sets the container instance.
<?php
namespace Illuminate\Support\Facades;
/**
* @method static \Illuminate\Validation\Validator make(array $data, array $rules, array $messages = [], array $attributes = [])
* @method static array validate(array $data, array $rules, array $messages = [], array $attributes = [])
* @method static void extend(string $rule, \Closure|string $extension, string|null $message = null)
* @method static void extendImplicit(string $rule, \Closure|string $extension, string|null $message = null)
* @method static void extendDependent(string $rule, \Closure|string $extension, string|null $message = null)
* @method static void replacer(string $rule, \Closure|string $replacer)
* @method static void includeUnvalidatedArrayKeys()
* @method static void excludeUnvalidatedArrayKeys()
* @method static void resolver(\Closure $resolver)
* @method static \Illuminate\Contracts\Translation\Translator getTranslator()
* @method static \Illuminate\Validation\PresenceVerifierInterface getPresenceVerifier()
* @method static void setPresenceVerifier(\Illuminate\Validation\PresenceVerifierInterface $presenceVerifier)
* @method static \Illuminate\Contracts\Container\Container|null getContainer()
* @method static \Illuminate\Validation\Factory setContainer(\Illuminate\Contracts\Container\Container $container)
*
* @see \Illuminate\Validation\Factory
*/
class Validator extends Facade
{
/**
* Get the registered name of the component.
*
* @return string
*/
protected static function getFacadeAccessor()
{
return 'validator';
}
}