trait DatabaseRule

Properties

protected string $table

The table to run the query against.

protected string $column

The column to check on.

protected array $wheres

The extra where clauses for the query.

protected array $using

The array of custom query callbacks.

Methods

__construct(string $table, string $column = 'NULL')

Create a new rule instance.

string
resolveTableName(string $table)

Resolves the name of the table from the given string.

where(Closure|string $column, mixed $value = null)

Set a "where" constraint on the query.

whereNot(string $column, mixed $value)

Set a "where not" constraint on the query.

whereNull(string $column)

Set a "where null" constraint on the query.

whereNotNull(string $column)

Set a "where not null" constraint on the query.

whereIn(string $column, array|Arrayable|BackedEnum $values)

Set a "where in" constraint on the query.

whereNotIn(string $column, array|Arrayable|BackedEnum $values)

Set a "where not in" constraint on the query.

withoutTrashed(string $deletedAtColumn = 'deleted_at')

Ignore soft deleted models during the existence check.s.

onlyTrashed(string $deletedAtColumn = 'deleted_at')

Only include soft deleted models during the existence check.

using(Closure $callback)

Register a custom query callback.

array
queryCallbacks()

Get the custom query callbacks for the rule.

array
presenceMetadata()

Get the database presence rule metadata.

string
formatWheres()

Format the where clauses.

Details

at line 40
__construct(string $table, string $column = 'NULL')

Create a new rule instance.

Parameters

string $table
string $column

at line 50
string resolveTableName(string $table)

Resolves the name of the table from the given string.

Parameters

string $table

Return Value

string

at line 74
DatabaseRule where(Closure|string $column, mixed $value = null)

Set a "where" constraint on the query.

Parameters

Closure|string $column
mixed $value

Return Value

DatabaseRule

at line 98
DatabaseRule whereNot(string $column, mixed $value)

Set a "where not" constraint on the query.

Parameters

string $column
mixed $value

Return Value

DatabaseRule

at line 112
DatabaseRule whereNull(string $column)

Set a "where null" constraint on the query.

Parameters

string $column

Return Value

DatabaseRule

at line 120
DatabaseRule whereNotNull(string $column)

Set a "where not null" constraint on the query.

Parameters

string $column

Return Value

DatabaseRule

at line 128
DatabaseRule whereIn(string $column, array|Arrayable|BackedEnum $values)

Set a "where in" constraint on the query.

Parameters

string $column
array|Arrayable|BackedEnum $values

Return Value

DatabaseRule

at line 138
DatabaseRule whereNotIn(string $column, array|Arrayable|BackedEnum $values)

Set a "where not in" constraint on the query.

Parameters

string $column
array|Arrayable|BackedEnum $values

Return Value

DatabaseRule

at line 148
DatabaseRule withoutTrashed(string $deletedAtColumn = 'deleted_at')

Ignore soft deleted models during the existence check.s.

Parameters

string $deletedAtColumn

Return Value

DatabaseRule

at line 158
DatabaseRule onlyTrashed(string $deletedAtColumn = 'deleted_at')

Only include soft deleted models during the existence check.

Parameters

string $deletedAtColumn

Return Value

DatabaseRule

at line 168
DatabaseRule using(Closure $callback)

Register a custom query callback.

Parameters

Closure $callback

Return Value

DatabaseRule

at line 178
array queryCallbacks()

Get the custom query callbacks for the rule.

Return Value

array

at line 188
array presenceMetadata()

Get the database presence rule metadata.

Return Value

array

at line 201
protected string formatWheres()

Format the where clauses.

Return Value

string