class ForeignKeyDefinition extends Fluent

Traits

Properties

static protected array $macros

The registered string macros.

from  Macroable
protected TValue> $attributes

All of the attributes set on the fluent instance.

from  Fluent

Methods

mixed
when(mixed $value = null, callable|null $callback = null, callable|null $default = null)

Apply the callback if the given "value" is (or resolves to) truthy.

mixed
unless(mixed $value = null, callable|null $callback = null, callable|null $default = null)

Apply the callback if the given "value" is (or resolves to) falsy.

array
all(mixed $keys = null)

Retrieve all data from the instance.

mixed
data(string|null $key = null, mixed $default = null)

Retrieve data from the instance.

bool
exists(array|string $key)

Determine if the data contains a given key.

bool
has(array|string $key)

Determine if the data contains a given key.

bool
hasAny(array|string $keys)

Determine if the instance contains any of the given keys.

mixed
whenHas(string $key, callable $callback, callable|null $default = null)

Apply the callback if the instance contains the given key.

bool
filled(array|string $key)

Determine if the instance contains a non-empty value for the given key.

bool
isNotFilled(array|string $key)

Determine if the instance contains an empty value for the given key.

bool
anyFilled(array|string $keys)

Determine if the instance contains a non-empty value for any of the given keys.

mixed
whenFilled(string $key, callable $callback, callable|null $default = null)

Apply the callback if the instance contains a non-empty value for the given key.

mixed
whenEnum(string $key, string $enumClass, callable $callback, callable|null $default = null)

Apply the callback if the instance contains a valid enum value for the given key.

bool
missing(array|string $key)

Determine if the instance is missing a given key.

mixed
whenMissing(string $key, callable $callback, callable|null $default = null)

Apply the callback if the instance is missing the given key.

bool
isEmptyString(string $key)

Determine if the given key is an empty string for "filled".

str(string $key, mixed $default = null, bool $strict = false)

Retrieve data from the instance as a Stringable instance.

string(string $key, mixed $default = null, bool $strict = false)

Retrieve data from the instance as a Stringable instance.

bool|null
boolean(string|null $key = null, Closure|bool|null $default = false, bool $strict = false)

Retrieve data as a boolean value.

int|null
integer(string $key, Closure|int|null $default = 0, bool $strict = false)

Retrieve data as an integer value.

float|null
float(string $key, Closure|float|null $default = 0.0, bool $strict = false)

Retrieve data as a float value.

int|float
clamp(string $key, int|float $min, int|float $max, int|float $default = 0)

Retrieve data clamped between min and max values.

CarbonInterface|null
date(string $key, string|null $format = null, UnitEnum|string|null $tz = null)

Retrieve data from the instance as a Carbon instance.

CarbonInterval|null
interval(string $key, Unit|string|null $unit = null)

Retrieve data from the instance as a CarbonInterval instance.

mixed
enum(string $key, string $enumClass, mixed $default = null)

Retrieve data from the instance as an enum.

array
enums(string $key, string $enumClass)

Retrieve data from the instance as an array of enums.

array
array(array|string|null $key = null)

Retrieve data from the instance as an array.

collect(array|string|null $key = null)

Retrieve data from the instance as a collection.

array
only(mixed $keys)

Get a subset containing the provided keys with values from the instance data.

array
except(mixed $keys)

Get all of the data except for a specified array of items.

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

Register a custom macro.

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

Mix another object into the class.

static bool
hasMacro(string $name)

Check 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.

__construct(array|object $attributes = [])

Create a new fluent instance.

from  Fluent
static Fluent
make(array|object $attributes = [])

Create a new fluent instance.

from  Fluent
mixed
get(string|int|null $key = null, mixed $default = null)

Get an attribute from the fluent instance using "dot" notation.

from  Fluent
set(string|int $key, mixed $value)

Set an attribute on the fluent instance using "dot" notation.

from  Fluent
fill(array|object $attributes)

Fill the fluent instance with an array of attributes.

from  Fluent
mixed
value(string|int $key, mixed $default = null)

Get an attribute from the fluent instance.

from  Fluent
scope(string $key, mixed $default = null)

Get the value of the given key as a new Fluent instance.

from  Fluent
array
getAttributes()

Get the attributes from the fluent instance.

from  Fluent
array
toArray()

Convert the fluent instance to an array.

from  Fluent
array
jsonSerialize()

Convert the object into something JSON serializable.

from  Fluent
string
toJson(int $options = 0)

Convert the fluent instance to JSON.

from  Fluent
string
toPrettyJson(int $options = 0)

Convert the fluent instance to pretty print formatted JSON.

from  Fluent
bool
isEmpty()

Determine if the fluent instance is empty.

from  Fluent
bool
isNotEmpty()

Determine if the fluent instance is not empty.

from  Fluent
bool
offsetExists(mixed $offset)

Determine if the given offset exists.

from  Fluent
mixed
offsetGet(mixed $offset)

Get the value for a given offset.

from  Fluent
void
offsetSet(mixed $offset, mixed $value)

Set the value at the given offset.

from  Fluent
void
offsetUnset(mixed $offset)

Unset the value at the given offset.

from  Fluent
getIterator()

Get an iterator for the attributes.

from  Fluent
static void
flushState()

Flush all static state.

from  Fluent
mixed
__get(string $key)

Dynamically retrieve the value of an attribute.

from  Fluent
void
__set(string $key, mixed $value)

Dynamically set the value of an attribute.

from  Fluent
bool
__isset(string $key)

Dynamically check if an attribute is set.

from  Fluent
void
__unset(string $key)

Dynamically unset an attribute.

from  Fluent
cascadeOnUpdate()

Indicate that updates should cascade.

restrictOnUpdate()

Indicate that updates should be restricted.

nullOnUpdate()

Indicate that updates should set the foreign key value to null.

noActionOnUpdate()

Indicate that updates should have "no action".

cascadeOnDelete()

Indicate that deletes should cascade.

restrictOnDelete()

Indicate that deletes should be restricted.

nullOnDelete()

Indicate that deletes should set the foreign key value to null.

noActionOnDelete()

Indicate that deletes should have "no action".

$this
deferrable(bool $value = 'true') Set the foreign key as deferrable (PostgreSQL)

No description

$this
initiallyImmediate(bool $value = 'true') Set the default time to check the constraint (PostgreSQL)

No description

$this
inplace(bool $value = 'true') Specify that algorithm=inplace should be used for the foreign key operation, which $equires foreign key checks to be disabled (MySQL)

No description

$this
lock("default"|"exclusive"|"none"|"shared" $value) Specify the DDL lock mode for the foreign key operation (MySQL)

No description

$this
on(string $table)

Specify the referenced table

$this
onDelete(string $action)

Add an ON DELETE action

$this
onUpdate(string $action)

Add an ON UPDATE action

$this
references(string|string[] $columns) Specify the referenced column(s)

No description

Details

in Conditionable at line 23
mixed when(mixed $value = null, callable|null $callback = null, callable|null $default = null)

Apply the callback if the given "value" is (or resolves to) truthy.

Parameters

mixed $value
callable|null $callback
callable|null $default

Return Value

mixed

in Conditionable at line 56
mixed unless(mixed $value = null, callable|null $callback = null, callable|null $default = null)

Apply the callback if the given "value" is (or resolves to) falsy.

Parameters

mixed $value
callable|null $callback
callable|null $default

Return Value

mixed

in InteractsWithData at line 30
abstract array all(mixed $keys = null)

Retrieve all data from the instance.

Parameters

mixed $keys

Return Value

array

in InteractsWithData at line 35
abstract protected mixed data(string|null $key = null, mixed $default = null)

Retrieve data from the instance.

Parameters

string|null $key
mixed $default

Return Value

mixed

in InteractsWithData at line 40
bool exists(array|string $key)

Determine if the data contains a given key.

Parameters

array|string $key

Return Value

bool

in InteractsWithData at line 48
bool has(array|string $key)

Determine if the data contains a given key.

Parameters

array|string $key

Return Value

bool

in InteractsWithData at line 67
bool hasAny(array|string $keys)

Determine if the instance contains any of the given keys.

Parameters

array|string $keys

Return Value

bool

in InteractsWithData at line 86
mixed whenHas(string $key, callable $callback, callable|null $default = null)

Apply the callback if the instance contains the given key.

Parameters

string $key
callable $callback
callable|null $default

Return Value

mixed

in InteractsWithData at line 102
bool filled(array|string $key)

Determine if the instance contains a non-empty value for the given key.

Parameters

array|string $key

Return Value

bool

in InteractsWithData at line 119
bool isNotFilled(array|string $key)

Determine if the instance contains an empty value for the given key.

Parameters

array|string $key

Return Value

bool

in InteractsWithData at line 136
bool anyFilled(array|string $keys)

Determine if the instance contains a non-empty value for any of the given keys.

Parameters

array|string $keys

Return Value

bool

in InteractsWithData at line 160
mixed whenFilled(string $key, callable $callback, callable|null $default = null)

Apply the callback if the instance contains a non-empty value for the given key.

Parameters

string $key
callable $callback
callable|null $default

Return Value

mixed

in InteractsWithData at line 185
mixed whenEnum(string $key, string $enumClass, callable $callback, callable|null $default = null)

Apply the callback if the instance contains a valid enum value for the given key.

Parameters

string $key
string $enumClass
callable $callback
callable|null $default

Return Value

mixed

in InteractsWithData at line 201
bool missing(array|string $key)

Determine if the instance is missing a given key.

Parameters

array|string $key

Return Value

bool

in InteractsWithData at line 218
mixed whenMissing(string $key, callable $callback, callable|null $default = null)

Apply the callback if the instance is missing the given key.

Parameters

string $key
callable $callback
callable|null $default

Return Value

mixed

in InteractsWithData at line 234
protected bool isEmptyString(string $key)

Determine if the given key is an empty string for "filled".

Parameters

string $key

Return Value

bool

in InteractsWithData at line 246
Stringable str(string $key, mixed $default = null, bool $strict = false)

Retrieve data from the instance as a Stringable instance.

Parameters

string $key
mixed $default
bool $strict

Return Value

Stringable

in InteractsWithData at line 256
Stringable string(string $key, mixed $default = null, bool $strict = false)

Retrieve data from the instance as a Stringable instance.

When strict, values that are not strings, numbers, or Stringable objects return the default.

Parameters

string $key
mixed $default
bool $strict

Return Value

Stringable

in InteractsWithData at line 279
bool|null boolean(string|null $key = null, Closure|bool|null $default = false, bool $strict = false)

Retrieve data as a boolean value.

Returns true when value is "1", "true", "on", and "yes". Otherwise, returns false. When strict, unrecognized or empty values return the default.

Parameters

string|null $key
Closure|bool|null $default
bool $strict

Return Value

bool|null

in InteractsWithData at line 301
int|null integer(string $key, Closure|int|null $default = 0, bool $strict = false)

Retrieve data as an integer value.

When strict, values that are not valid integers return the default.

Parameters

string $key
Closure|int|null $default
bool $strict

Return Value

int|null

in InteractsWithData at line 328
float|null float(string $key, Closure|float|null $default = 0.0, bool $strict = false)

Retrieve data as a float value.

When strict, values that are not valid numbers return the default.

Parameters

string $key
Closure|float|null $default
bool $strict

Return Value

float|null

in InteractsWithData at line 347
int|float clamp(string $key, int|float $min, int|float $max, int|float $default = 0)

Retrieve data clamped between min and max values.

Parameters

string $key
int|float $min
int|float $max
int|float $default

Return Value

int|float

in InteractsWithData at line 365
CarbonInterface|null date(string $key, string|null $format = null, UnitEnum|string|null $tz = null)

Retrieve data from the instance as a Carbon instance.

Parameters

string $key
string|null $format
UnitEnum|string|null $tz

Return Value

CarbonInterface|null

Exceptions

InvalidFormatException

in InteractsWithData at line 383
CarbonInterval|null interval(string $key, Unit|string|null $unit = null)

Retrieve data from the instance as a CarbonInterval instance.

Parameters

string $key
Unit|string|null $unit

Return Value

CarbonInterval|null

in InteractsWithData at line 410
mixed enum(string $key, string $enumClass, mixed $default = null)

Retrieve data from the instance as an enum.

Parameters

string $key
string $enumClass
mixed $default

Return Value

mixed

in InteractsWithData at line 427
array enums(string $key, string $enumClass)

Retrieve data from the instance as an array of enums.

Parameters

string $key
string $enumClass

Return Value

array

in InteractsWithData at line 442
array array(array|string|null $key = null)

Retrieve data from the instance as an array.

Parameters

array|string|null $key

Return Value

array

in InteractsWithData at line 452
Collection collect(array|string|null $key = null)

Retrieve data from the instance as a collection.

Parameters

array|string|null $key

Return Value

Collection

in InteractsWithData at line 460
array only(mixed $keys)

Get a subset containing the provided keys with values from the instance data.

Parameters

mixed $keys

Return Value

array

in InteractsWithData at line 482
array except(mixed $keys)

Get all of the data except for a specified array of items.

Parameters

mixed $keys

Return Value

array

in Macroable at line 30
static void macro(string $name, callable|object $macro)

Register a custom macro.

Macros persist in a static property for the worker lifetime and apply to every subsequent call on the macroable class.

Parameters

string $name
callable|object $macro

Return Value

void

in Macroable at line 44
static void mixin(object $mixin, bool $replace = true)

Mix another object into the class.

Delegates to macro() for each method; registered macros persist in a static property for the worker lifetime.

Parameters

object $mixin
bool $replace

Return Value

void

Exceptions

ReflectionException

in Macroable at line 61
static bool hasMacro(string $name)

Check if macro is registered.

Parameters

string $name

Return Value

bool

in Macroable at line 72
static void flushMacros()

Flush the existing macros.

Clears worker-wide macros; concurrent coroutines may resolve different methods depending on timing.

Return Value

void

in Macroable at line 83
static mixed __callStatic(string $method, array $parameters)

Dynamically handle calls to the class.

Parameters

string $method
array $parameters

Return Value

mixed

Exceptions

BadMethodCallException

in Macroable at line 108
mixed __call(string $method, array $parameters)

Dynamically handle calls to the class.

Parameters

string $method
array $parameters

Return Value

mixed

Exceptions

BadMethodCallException

in Fluent at line 46
__construct(array|object $attributes = [])

Create a new fluent instance.

Parameters

array|object $attributes

in Fluent at line 56
static Fluent make(array|object $attributes = [])

Create a new fluent instance.

Parameters

array|object $attributes

Return Value

Fluent

in Fluent at line 69
mixed get(string|int|null $key = null, mixed $default = null)

Get an attribute from the fluent instance using "dot" notation.

Parameters

string|int|null $key
mixed $default

Return Value

mixed

in Fluent at line 79
Fluent set(string|int $key, mixed $value)

Set an attribute on the fluent instance using "dot" notation.

Parameters

string|int $key
mixed $value

Return Value

Fluent

in Fluent at line 92
Fluent fill(array|object $attributes)

Fill the fluent instance with an array of attributes.

Parameters

array|object $attributes

Return Value

Fluent

in Fluent at line 104
mixed value(string|int $key, mixed $default = null)

Get an attribute from the fluent instance.

Parameters

string|int $key
mixed $default

Return Value

mixed

in Fluent at line 116
Fluent scope(string $key, mixed $default = null)

Get the value of the given key as a new Fluent instance.

Parameters

string $key
mixed $default

Return Value

Fluent

in Fluent at line 158
array getAttributes()

Get the attributes from the fluent instance.

Return Value

array

in Fluent at line 168
array toArray()

Convert the fluent instance to an array.

Return Value

array

in Fluent at line 178
array jsonSerialize()

Convert the object into something JSON serializable.

Return Value

array

in Fluent at line 188
string toJson(int $options = 0)

Convert the fluent instance to JSON.

Parameters

int $options

Return Value

string

Exceptions

JsonException

in Fluent at line 198
string toPrettyJson(int $options = 0)

Convert the fluent instance to pretty print formatted JSON.

Parameters

int $options

Return Value

string

Exceptions

JsonException

in Fluent at line 206
bool isEmpty()

Determine if the fluent instance is empty.

Return Value

bool

in Fluent at line 214
bool isNotEmpty()

Determine if the fluent instance is not empty.

Return Value

bool

in Fluent at line 224
bool offsetExists(mixed $offset)

Determine if the given offset exists.

Parameters

mixed $offset

Return Value

bool

in Fluent at line 235
mixed offsetGet(mixed $offset)

Get the value for a given offset.

Parameters

mixed $offset

Return Value

mixed

in Fluent at line 246
void offsetSet(mixed $offset, mixed $value)

Set the value at the given offset.

Parameters

mixed $offset
mixed $value

Return Value

void

in Fluent at line 256
void offsetUnset(mixed $offset)

Unset the value at the given offset.

Parameters

mixed $offset

Return Value

void

in Fluent at line 266
Traversable getIterator()

Get an iterator for the attributes.

Return Value

Traversable

in Fluent at line 274
static void flushState()

Flush all static state.

Return Value

void

in Fluent at line 300
mixed __get(string $key)

Dynamically retrieve the value of an attribute.

Parameters

string $key

Return Value

mixed

in Fluent at line 308
void __set(string $key, mixed $value)

Dynamically set the value of an attribute.

Parameters

string $key
mixed $value

Return Value

void

in Fluent at line 316
bool __isset(string $key)

Dynamically check if an attribute is set.

Parameters

string $key

Return Value

bool

in Fluent at line 324
void __unset(string $key)

Dynamically unset an attribute.

Parameters

string $key

Return Value

void

at line 26
ForeignKeyDefinition cascadeOnUpdate()

Indicate that updates should cascade.

Return Value

ForeignKeyDefinition

at line 36
ForeignKeyDefinition restrictOnUpdate()

Indicate that updates should be restricted.

Return Value

ForeignKeyDefinition

at line 46
ForeignKeyDefinition nullOnUpdate()

Indicate that updates should set the foreign key value to null.

Return Value

ForeignKeyDefinition

at line 56
ForeignKeyDefinition noActionOnUpdate()

Indicate that updates should have "no action".

Return Value

ForeignKeyDefinition

at line 66
ForeignKeyDefinition cascadeOnDelete()

Indicate that deletes should cascade.

Return Value

ForeignKeyDefinition

at line 76
ForeignKeyDefinition restrictOnDelete()

Indicate that deletes should be restricted.

Return Value

ForeignKeyDefinition

at line 86
ForeignKeyDefinition nullOnDelete()

Indicate that deletes should set the foreign key value to null.

Return Value

ForeignKeyDefinition

at line 96
ForeignKeyDefinition noActionOnDelete()

Indicate that deletes should have "no action".

Return Value

ForeignKeyDefinition

at line 19
$this deferrable(bool $value = 'true') Set the foreign key as deferrable (PostgreSQL)

No description

Parameters

bool $value

Return Value

$this

at line 19
$this initiallyImmediate(bool $value = 'true') Set the default time to check the constraint (PostgreSQL)

No description

Parameters

bool $value

Return Value

$this

at line 19
$this inplace(bool $value = 'true') Specify that algorithm=inplace should be used for the foreign key operation, which $equires foreign key checks to be disabled (MySQL)

No description

Parameters

bool $value
which $equires foreign key checks to be disabled (MySQL

Return Value

$this

at line 19
$this lock("default"|"exclusive"|"none"|"shared" $value) Specify the DDL lock mode for the foreign key operation (MySQL)

No description

Parameters

"default"|"exclusive"|"none"|"shared" $value) Specify the DDL lock mode for the foreign key operation (MySQL

Return Value

$this

at line 19
$this on(string $table)

Specify the referenced table

Parameters

string $table

Return Value

$this

at line 19
$this onDelete(string $action)

Add an ON DELETE action

Parameters

string $action

Return Value

$this

at line 19
$this onUpdate(string $action)

Add an ON UPDATE action

Parameters

string $action

Return Value

$this

at line 19
$this references(string|string[] $columns) Specify the referenced column(s)

No description

Parameters

string|string[] $columns) Specify the referenced column(s

Return Value

$this