Rule
class Rule (View source)
Traits
Properties
static protected array | $macros | The registered string macros. |
from Macroable |
Methods
Mix another object into the class.
Dynamically handle calls to the class.
Dynamically handle calls to the class.
Apply the given rules if the given condition is truthy.
Apply the given rules if the given condition is falsy.
Create a new nested rule set.
Get a unique constraint builder instance.
Get an exists constraint builder instance.
Get a required_if rule builder instance.
Get a prohibited_if rule builder instance.
Get a dimensions rule builder instance.
Details
static ConditionalRules
when(callable|bool $condition, ValidationRule|InvokableRule|Rule|Closure|array|string $rules, ValidationRule|InvokableRule|Rule|Closure|array|string $defaultRules = [])
Apply the given rules if the given condition is truthy.
static ConditionalRules
unless(callable|bool $condition, ValidationRule|InvokableRule|Rule|Closure|array|string $rules, ValidationRule|InvokableRule|Rule|Closure|array|string $defaultRules = [])
Apply the given rules if the given condition is falsy.
static Unique
unique(string $table, string $column = 'NULL')
Get a unique constraint builder instance.
static Exists
exists(string $table, string $column = 'NULL')
Get an exists constraint builder instance.
static NotIn
notIn(Arrayable|BackedEnum|UnitEnum|array|string $values)
Get a not_in rule builder instance.
static ProhibitedIf
prohibitedIf(callable|bool $callback)
Get a prohibited_if rule builder instance.
static object|stdClass
compile(string $attribute, array $rules, array|null $data = null)
Compile a set of rules for an attribute.