On this page
Rule
class Rule (View source)
Traits
Properties
static protected array | $macros | The registered string macros. |
from Macroable |
Methods
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 ConditionalRules | when(callable|bool $condition, array|string|Closure $rules, array|string|Closure $defaultRules = []) Create a new conditional rule set. |
|
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|array|string $values) Get an in constraint builder instance. |
|
static NotIn | notIn(Arrayable|array|string $values) Get a not_in constraint builder instance. |
|
static RequiredIf | requiredIf(callable|bool $callback) Get a required_if constraint builder instance. |
|
static ExcludeIf | excludeIf(callable|bool $callback) Get a exclude_if constraint builder instance. |
|
static ProhibitedIf | prohibitedIf(callable|bool $callback) Get a prohibited_if constraint builder instance. |
|
static Enum | enum(string $type) Get an enum constraint builder instance. |
|
static File | file() Get a file constraint builder instance. |
|
static ImageFile | imageFile() Get an image file constraint builder instance. |
|
static Dimensions | dimensions(array $constraints = []) Get a dimensions constraint builder instance. |
Details
static void macro(string $name, object|callable $macro)
Register a custom macro.
static void mixin(object $mixin, bool $replace = true)
Mix another object into the class.
static bool hasMacro(string $name)
Checks if macro is registered.
static void flushMacros()
Flush the existing macros.
static mixed __callStatic(string $method, array $parameters)
Dynamically handle calls to the class.
mixed __call(string $method, array $parameters)
Dynamically handle calls to the class.
static ConditionalRules when(callable|bool $condition, array|string|Closure $rules, array|string|Closure $defaultRules = [])
Create a new conditional rule set.
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 RequiredIf requiredIf(callable|bool $callback)
Get a required_if constraint builder instance.
static ExcludeIf excludeIf(callable|bool $callback)
Get a exclude_if constraint builder instance.
static ProhibitedIf prohibitedIf(callable|bool $callback)
Get a prohibited_if constraint builder instance.
static Enum enum(string $type)
Get an enum constraint builder instance.
static File file()
Get a file constraint builder instance.
static ImageFile imageFile()
Get an image file constraint builder instance.
static Dimensions dimensions(array $constraints = [])
Get a dimensions constraint builder instance.
© Taylor Otwell
Licensed under the MIT License.
Laravel is a trademark of Taylor Otwell.
https://laravel.com/api/10.x/Illuminate/Validation/Rule.html