class Can implements Rule, ValidatorAwareRule (View source)

Properties

protected string $ability

The ability to check.

protected array $arguments

The arguments to pass to the authorization check.

protected Validator $validator

The current validator instance.

Methods

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

Constructor.

bool
passes(string $attribute, mixed $value)

Determine if the validation rule passes.

string|array
message()

Get the validation error message.

$this
setValidator(Validator $validator)

Set the current validator.

Details

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

Constructor.

Parameters

string $ability
array $arguments

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 message.

Return Value

string|array

$this setValidator(Validator $validator)

Set the current validator.

Parameters

Validator $validator

Return Value

$this