Documentation

Unique
in package
Uses DatabaseRule

Table of Contents

$column  : string
The column to check on.
$idColumn  : string
The name of the ID column.
$ignore  : mixed
The ID that should be ignored.
$table  : string
The table to run the query against.
$using  : array<string|int, mixed>
The array of custom query callbacks.
$wheres  : array<string|int, mixed>
There extra where clauses for the query.
__construct()  : void
Create a new rule instance.
__toString()  : string
Convert the rule to a validation string.
ignore()  : $this
Ignore the given ID during the unique check.
queryCallbacks()  : array<string|int, mixed>
Get the custom query callbacks for the rule.
using()  : $this
Register a custom query callback.
where()  : $this
Set a "where" constraint on the query.
whereIn()  : $this
Set a "where in" constraint on the query.
whereNot()  : $this
Set a "where not" constraint on the query.
whereNotIn()  : $this
Set a "where not in" constraint on the query.
whereNotNull()  : $this
Set a "where not null" constraint on the query.
whereNull()  : $this
Set a "where null" constraint on the query.
formatWheres()  : string
Format the where clauses.

Properties

$column

The column to check on.

protected string $column

$idColumn

The name of the ID column.

protected string $idColumn = 'id'

$ignore

The ID that should be ignored.

protected mixed $ignore

$table

The table to run the query against.

protected string $table

$using

The array of custom query callbacks.

protected array<string|int, mixed> $using = []

$wheres

There extra where clauses for the query.

protected array<string|int, mixed> $wheres = []

Methods

__construct()

Create a new rule instance.

public __construct(string $table[, string $column = 'NULL' ]) : void
Parameters
$table : string
$column : string = 'NULL'
Return values
void

__toString()

Convert the rule to a validation string.

public __toString() : string
Return values
string

ignore()

Ignore the given ID during the unique check.

public ignore(mixed $id[, string $idColumn = 'id' ]) : $this
Parameters
$id : mixed
$idColumn : string = 'id'
Return values
$this

queryCallbacks()

Get the custom query callbacks for the rule.

public queryCallbacks() : array<string|int, mixed>
Return values
array<string|int, mixed>

using()

Register a custom query callback.

public using(Closure $callback) : $this
Parameters
$callback : Closure
Return values
$this

where()

Set a "where" constraint on the query.

public where(string|Closure $column[, array<string|int, mixed>|string|null $value = null ]) : $this
Parameters
$column : string|Closure
$value : array<string|int, mixed>|string|null = null
Return values
$this

whereIn()

Set a "where in" constraint on the query.

public whereIn(string $column, array<string|int, mixed> $values) : $this
Parameters
$column : string
$values : array<string|int, mixed>
Return values
$this

whereNot()

Set a "where not" constraint on the query.

public whereNot(string $column, array<string|int, mixed>|string $value) : $this
Parameters
$column : string
$value : array<string|int, mixed>|string
Return values
$this

whereNotIn()

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

public whereNotIn(string $column, array<string|int, mixed> $values) : $this
Parameters
$column : string
$values : array<string|int, mixed>
Return values
$this

whereNotNull()

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

public whereNotNull(string $column) : $this
Parameters
$column : string
Return values
$this

whereNull()

Set a "where null" constraint on the query.

public whereNull(string $column) : $this
Parameters
$column : string
Return values
$this

formatWheres()

Format the where clauses.

protected formatWheres() : string
Return values
string

Search results