Rule

class Rule (View source)

Traits

Macroable

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 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 Dimensions dimensions(array $constraints = [])

Get a dimensions 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 Unique unique(string $table, string $column = 'NULL')

Get a unique constraint builder instance.

Details

static void macro(string $name, object|callable $macro)

Register a custom macro.

Parameters

string $name
object|callable $macro

Return Value

void

static void mixin(object $mixin, bool $replace = true)

Mix another object into the class.

Parameters

object $mixin
bool $replace

Return Value

void

Exceptions

ReflectionException

static bool hasMacro(string $name)

Checks if macro is registered.

Parameters

string $name

Return Value

bool

static mixed __callStatic(string $method, array $parameters)

Dynamically handle calls to the class.

Parameters

string $method
array $parameters

Return Value

mixed

Exceptions

BadMethodCallException

mixed __call(string $method, array $parameters)

Dynamically handle calls to the class.

Parameters

string $method
array $parameters

Return Value

mixed

Exceptions

BadMethodCallException

static Dimensions dimensions(array $constraints = [])

Get a dimensions constraint builder instance.

Parameters

array $constraints

Return Value

Dimensions

static Exists exists(string $table, string $column = 'NULL')

Get an exists constraint builder instance.

Parameters

string $table
string $column

Return Value

Exists

static In in(Arrayable|array|string $values)

Get an in constraint builder instance.

Parameters

Arrayable|array|string $values

Return Value

In

static NotIn notIn(Arrayable|array|string $values)

Get a not_in constraint builder instance.

Parameters

Arrayable|array|string $values

Return Value

NotIn

static RequiredIf requiredIf(callable|bool $callback)

Get a required_if constraint builder instance.

Parameters

callable|bool $callback

Return Value

RequiredIf

static Unique unique(string $table, string $column = 'NULL')

Get a unique constraint builder instance.

Parameters

string $table
string $column

Return Value

Unique

© Taylor Otwell
Licensed under the MIT License.
Laravel is a trademark of Taylor Otwell.
https://laravel.com/api/8.x/Illuminate/Validation/Rule.html