class ClosureValidationRule implements Rule, ValidatorAwareRule (View source)

Properties

Closure $callback

The callback that validates the attribute.

bool $failed

Indicates if the validation callback failed.

array $messages

The validation error messages.

protected Validator $validator

The current validator.

protected Closure $destructor

The callback to call when the object destructs.

Methods

__construct(string $message, Translator $translator, Closure $destructor)

Create a new pending potentially translated string.

bool
passes(string $attribute, mixed $value)

Determine if the validation rule passes.

string|array
message()

Get the validation error messages.

$this
setValidator(Validator $validator)

Set the current validator.

pendingPotentiallyTranslatedString(string $attribute, ?string $message)

Create a pending potentially translated string.

void
__destruct()

Handle the object's destruction.

Details

__construct(string $message, Translator $translator, Closure $destructor)

Create a new pending potentially translated string.

Parameters

string $message
Translator $translator
Closure $destructor

bool passes(string $attribute, mixed $value)

Determine if the validation rule passes.

Parameters

string $attribute
mixed $value

Return Value

bool

string|array message()

Get the validation error messages.

Return Value

string|array

$this setValidator(Validator $validator)

Set the current validator.

Parameters

Validator $validator

Return Value

$this

protected PotentiallyTranslatedString pendingPotentiallyTranslatedString(string $attribute, ?string $message)

Create a pending potentially translated string.

Parameters

string $attribute
?string $message

Return Value

PotentiallyTranslatedString

void __destruct()

Handle the object's destruction.

Return Value

void