class ClosureValidationRule implements Rule, ValidatorAwareRule

Traits

Properties

protected Closure $destructor

The callback to call when the object destructs.

from  CreatesPotentiallyTranslatedStrings
bool $failed

Indicates if the validation callback failed.

array $messages

The validation error messages.

protected Validator|null $validator

The current validator.

Methods

pendingPotentiallyTranslatedString(string $attribute, string|null $message)

Create a pending potentially translated string.

__construct(Closure $callback)

Create a new Closure based validation rule.

__destruct()

Handle the object's destruction.

bool
passes(string $attribute, mixed $value)

Determine if the validation rule passes.

array|string
message()

Get the validation error messages.

setValidator(Validator $validator)

Set the current validator.

Details

protected PotentiallyTranslatedString pendingPotentiallyTranslatedString(string $attribute, string|null $message)

Create a pending potentially translated string.

Parameters

string $attribute
string|null $message

Return Value

PotentiallyTranslatedString

at line 37
__construct(Closure $callback)

Create a new Closure based validation rule.

Parameters

Closure $callback

the callback that validates the attribute

__destruct()

Handle the object's destruction.

at line 45
bool passes(string $attribute, mixed $value)

Determine if the validation rule passes.

Parameters

string $attribute
mixed $value

Return Value

bool

at line 61
array|string message()

Get the validation error messages.

Return Value

array|string

at line 69
ValidatorAwareRule setValidator(Validator $validator)

Set the current validator.

Parameters

Validator $validator

Return Value

ValidatorAwareRule