interface Validator implements MessageProvider

Methods

getMessageBag()

Get the messages for the instance.

array
validate()

Run the validator's rules against its data.

array
validated()

Get the attributes and values that were validated.

bool
fails()

Determine if the data fails the validation rules.

array
failed()

Get the failed validation rules.

sometimes(array|string $attribute, array|string $rules, callable $callback)

Add conditions to a given field based on a Closure.

after(callable|string $callback)

Add an after validation callback.

errors()

Get all of the validation error messages.

getTranslator()

Get the Translator implementation.

array
getData()

Get the data under validation.

setData(array $data)

Set the data under validation.

array
getRulesWithoutPlaceholders()

Get the validation rules with key placeholders removed.

setRules(array $rules)

Set the validation rules.

safe(array|null $keys = null)

Get a validated input container for the validated input.

stopOnFirstFailure(bool $stopOnFirstFailure = true)

Instruct the validator to stop validating after the first rule failure.

bool
hasRule(string $attribute, array|string $rules)

Determine if a given rule is defined for a given attribute.

string
getException()

Get the exception to throw upon failed validation.

Details

in MessageProvider at line 12
MessageBag getMessageBag()

Get the messages for the instance.

Return Value

MessageBag

at line 20
array validate()

Run the validator's rules against its data.

Return Value

array

Exceptions

ValidationException

at line 27
array validated()

Get the attributes and values that were validated.

Return Value

array

Exceptions

ValidationException

at line 32
bool fails()

Determine if the data fails the validation rules.

Return Value

bool

at line 37
array failed()

Get the failed validation rules.

Return Value

array

at line 42
Validator sometimes(array|string $attribute, array|string $rules, callable $callback)

Add conditions to a given field based on a Closure.

Parameters

array|string $attribute
array|string $rules
callable $callback

Return Value

Validator

at line 47
Validator after(callable|string $callback)

Add an after validation callback.

Parameters

callable|string $callback

Return Value

Validator

at line 52
MessageBag errors()

Get all of the validation error messages.

Return Value

MessageBag

at line 57
Translator getTranslator()

Get the Translator implementation.

Return Value

Translator

at line 62
array getData()

Get the data under validation.

Return Value

array

at line 67
Validator setData(array $data)

Set the data under validation.

Parameters

array $data

Return Value

Validator

at line 72
array getRulesWithoutPlaceholders()

Get the validation rules with key placeholders removed.

Return Value

array

at line 77
Validator setRules(array $rules)

Set the validation rules.

Parameters

array $rules

Return Value

Validator

at line 82
array|ValidatedInput safe(array|null $keys = null)

Get a validated input container for the validated input.

Parameters

array|null $keys

Return Value

array|ValidatedInput

at line 89
Validator stopOnFirstFailure(bool $stopOnFirstFailure = true)

Instruct the validator to stop validating after the first rule failure.

Parameters

bool $stopOnFirstFailure

Return Value

Validator

at line 94
bool hasRule(string $attribute, array|string $rules)

Determine if a given rule is defined for a given attribute.

Parameters

string $attribute
array|string $rules

Return Value

bool

at line 101
string getException()

Get the exception to throw upon failed validation.

Return Value

string