trait Illuminate / Validation / Rules / DatabaseRule
You're browsing the documentation for an upcoming version of Laravel. The documentation and features of this release are subject to change.

DatabaseRule

Properties

protected

$table string

The table to run the query against.

Default: null
protected

$column string

The column to check on.

Default: null
protected

$wheres array

The extra where clauses for the query.

Default: []
protected

$using array

The array of custom query callbacks.

Default: []

Methods

public

__construct ( $table , $column ) : void

Create a new rule instance.

Parameters

  • $table string
  • $column string
public

resolveTableName ( $table ) : string

Resolves the name of the table from the given string.

Parameters

  • $table string
public

where ( $column , $value ) : $this

Set a "where" constraint on the query.

Parameters

  • $column Closure |string
  • $value Illuminate\...\Arrayable|BackedEnum|Closure |array|string|int|bool|null
public

whereNot ( $column , $value ) : $this

Set a "where not" constraint on the query.

Parameters

  • $column string
  • $value Illuminate\...\Arrayable|BackedEnum|array|string
public

whereNull ( $column ) : $this

Set a "where null" constraint on the query.

Parameters

  • $column string
public

whereNotNull ( $column ) : $this

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

Parameters

  • $column string
public

whereIn ( $column , $values ) : $this

Set a "where in" constraint on the query.

Parameters

  • $column string
  • $values Illuminate\...\Arrayable|BackedEnum|array
public

whereNotIn ( $column , $values ) : $this

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

Parameters

  • $column string
  • $values Illuminate\...\Arrayable|BackedEnum|array
public

withoutTrashed ( $deletedAtColumn ) : $this

Ignore soft deleted models during the existence check.

Parameters

  • $deletedAtColumn string
public

onlyTrashed ( $deletedAtColumn ) : $this

Only include soft deleted models during the existence check.

Parameters

  • $deletedAtColumn string
public

using ( Closure $callback ) : $this

Register a custom query callback.

Parameters

public

queryCallbacks ( ) : array

Get the custom query callbacks for the rule.

protected

formatWheres ( ) : string

Format the where clauses.