class Can implements Rule, ValidatorAwareRule

Properties

protected Validator|null $validator

The current validator instance.

Methods

__construct(string $ability, array $arguments = [])

Constructor.

bool
passes(string $attribute, mixed $value)

Determine if the validation rule passes.

array|string
message()

Get the validation error message.

setValidator(Validator $validator)

Set the current validator.

Details

at line 25
__construct(string $ability, array $arguments = [])

Constructor.

Parameters

string $ability

the ability to check

array $arguments

the arguments to pass to the authorization check

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

Determine if the validation rule passes.

Parameters

string $attribute
mixed $value

Return Value

bool

at line 48
array|string message()

Get the validation error message.

Return Value

array|string

at line 60
ValidatorAwareRule setValidator(Validator $validator)

Set the current validator.

Parameters

Validator $validator

Return Value

ValidatorAwareRule