class Illuminate / Validation / Factory
You're browsing the documentation for an upcoming version of Laravel. The documentation and features of this release are subject to change.

Factory

Implements

Properties

protected

$translator Translator

The Translator implementation.

Default: null
protected

$verifier PresenceVerifierInterface

The Presence Verifier implementation.

Default: null
protected

$container Container |null

The IoC container instance.

Default: null
protected

$extensions array|string>

All of the custom validator extensions.

Default: []
protected

$implicitExtensions array|string>

All of the custom implicit validator extensions.

Default: []
protected

$dependentExtensions array|string>

All of the custom dependent validator extensions.

Default: []
protected

$replacers array|string>

All of the custom validator message replacers.

Default: []
protected

$fallbackMessages array

All of the fallback messages for custom rules.

Default: []
protected

$excludeUnvalidatedArrayKeys bool

Indicates that unvalidated array keys should be excluded, even if the parent array was validated.

Default: true
protected

$resolver Closure

The Validator resolver instance.

Default: null

Methods

public

__construct ( Translator $translator , Container $container ) : void

Create a new Validator factory instance.

Parameters

public

make ( array $data , array $rules , array $messages , array $attributes ) : Validator

Create a new Validator instance.

Parameters

  • $data array
  • $rules array
  • $messages array
  • $attributes array
public

validate ( array $data , array $rules , array $messages , array $attributes ) : array

Validate the given data against the provided rules.

Parameters

  • $data array
  • $rules array
  • $messages array
  • $attributes array
protected

resolve ( array $data , array $rules , array $messages , array $attributes ) : Validator

Resolve a new Validator instance.

Parameters

  • $data array
  • $rules array
  • $messages array
  • $attributes array
protected

addExtensions ( Validator $validator ) : void

Add the extensions to a validator instance.

Parameters

public

extend ( $rule , $extension , $message ) : void

Register a custom validator extension.

Parameters

  • $rule string
  • $extension Closure |string
  • $message string|null
public

extendImplicit ( $rule , $extension , $message ) : void

Register a custom implicit validator extension.

Parameters

  • $rule string
  • $extension Closure |string
  • $message string|null
public

extendDependent ( $rule , $extension , $message ) : void

Register a custom dependent validator extension.

Parameters

  • $rule string
  • $extension Closure |string
  • $message string|null
public

replacer ( $rule , $replacer ) : void

Register a custom validator message replacer.

Parameters

  • $rule string
  • $replacer Closure |string
public

includeUnvalidatedArrayKeys ( ) : void

Indicate that unvalidated array keys should be included in validated data when the parent array is validated.

public

excludeUnvalidatedArrayKeys ( ) : void

Indicate that unvalidated array keys should be excluded from the validated data, even if the parent array was validated.

public

resolver ( Closure $resolver ) : void

Set the Validator instance resolver.

Parameters

public

getTranslator ( ) : Translator

Get the Translator implementation.

public

getPresenceVerifier ( ) : PresenceVerifierInterface

Get the Presence Verifier implementation.

public

setPresenceVerifier ( PresenceVerifierInterface $presenceVerifier ) : void

Set the Presence Verifier implementation.

Parameters

public

getContainer ( ) : Container |null

Get the container instance used by the validation factory.

public

setContainer ( Container $container ) : $this

Set the container instance used by the validation factory.

Parameters