class Rule (View source)
| Macroable |
| static protected array | $macros | The registered string macros. | from Macroable |
| static void | macro(string $name, object|callable $macro)
Register a custom macro. | from Macroable |
| static void | mixin(object $mixin, bool $replace = true)
Mix another object into the class. | from Macroable |
| static bool | hasMacro(string $name)
Checks if macro is registered. | from Macroable |
| static void | flushMacros()
Flush the existing macros. | from Macroable |
| static mixed | __callStatic(string $method, array $parameters)
Dynamically handle calls to the class. | from Macroable |
| mixed | __call(string $method, array $parameters)
Dynamically handle calls to the class. | from Macroable |
| static Can | can(string $ability, mixed ...$arguments)
Get a can constraint builder instance. | |
| 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 ArrayRule | array(array|null $keys = null)
Get an array rule builder instance. | |
| static NestedRules | forEach(callable $callback)
Create a new nested rule set. | |
| 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 In | in(Arrayable|BackedEnum|UnitEnum|array|string $values)
Get an in rule builder instance. | |
| static NotIn | notIn(Arrayable|BackedEnum|UnitEnum|array|string $values)
Get a not_in rule builder instance. | |
| static RequiredIf | requiredIf(callable|bool $callback)
Get a required_if rule builder instance. | |
| static ExcludeIf | excludeIf(callable|bool $callback)
Get a exclude_if rule builder instance. | |
| static ProhibitedIf | prohibitedIf(callable|bool $callback)
Get a prohibited_if rule builder instance. | |
| static Enum | enum(class-string $type)
Get an enum rule builder instance. | |
| static File | file()
Get a file rule builder instance. | |
| static ImageFile | imageFile()
Get an image file rule builder instance. | |
| static Dimensions | dimensions(array $constraints = [])
Get a dimensions rule builder instance. |
Register a custom macro.
Mix another object into the class.
Checks if macro is registered.
Flush the existing macros.
Dynamically handle calls to the class.
Dynamically handle calls to the class.
Get a can constraint builder instance.
Apply the given rules if the given condition is truthy.
Apply the given rules if the given condition is falsy.
Get an array rule builder instance.
Create a new nested rule set.
Get a unique constraint builder instance.
Get an exists constraint builder instance.
Get a not_in rule builder instance.
Get a required_if rule builder instance.
Get a exclude_if rule builder instance.
Get a prohibited_if rule builder instance.
Get an enum rule builder instance.
Get a file rule builder instance.
Get an image file rule builder instance.
Get a dimensions rule builder instance.
© Taylor Otwell
Licensed under the MIT License.
Laravel is a trademark of Taylor Otwell.
https://laravel.com/api/11.x/Illuminate/Validation/Rule.html