ConditionalRules
class ConditionalRules (View source)
Properties
protected callable|bool | $condition | The boolean condition indicating if the rules should be added to the attribute. |
|
protected array|string | $rules | The rules to be added to the attribute. |
|
protected array|string | $defaultRules | The rules to be added to the attribute if the condition fails. |
Methods
void
__construct(callable|bool $condition, array|string $rules, array|string $defaultRules = [])
Create a new conditional rules instance.
bool
passes(array $data = [])
Determine if the conditional rules should be added.
array
rules()
Get the rules.
array
defaultRules()
Get the default rules.
Details
void
__construct(callable|bool $condition, array|string $rules, array|string $defaultRules = [])
Create a new conditional rules instance.
bool
passes(array $data = [])
Determine if the conditional rules should be added.
array
rules()
Get the rules.
array
defaultRules()
Get the default rules.