Unique
class Unique
Properties
protected string | $table | The table to run the query against. |
|
protected string | $column | The column to check for uniqueness on. |
|
protected mixed | $ignore | The ID that should be ignored. |
|
protected string | $idColumn | The name of the ID column. |
|
protected array | $wheres | There extra where clauses for the query. |
|
protected Closure|null | $using | The custom query callback. |
Methods
Create a new unique rule instance.
Set a "where" constraint on the query.
Set a "where not" constraint on the query.
Set a "where null" constraint on the query.
Set a "where not null" constraint on the query.
Ignore the given ID during the unique check.
Format the where clauses.
Get the custom query callbacks for the rule.
Convert the rule to a validation string.
Details
at line 58
void
__construct(string $table, string $column = 'NULL')
Create a new unique rule instance.
at line 71
$this
where(string $column, string $value = null)
Set a "where" constraint on the query.
at line 89
$this
whereNot(string $column, string $value)
Set a "where not" constraint on the query.
at line 100
$this
whereNull(string $column)
Set a "where null" constraint on the query.
at line 111
$this
whereNotNull(string $column)
Set a "where not null" constraint on the query.
at line 123
$this
ignore(mixed $id, string $idColumn = 'id')
Ignore the given ID during the unique check.
at line 137
$this
using(Closure $callback)
Register a custom query callback.
at line 149
protected string
formatWheres()
Format the where clauses.
at line 161
array
queryCallbacks()
Get the custom query callbacks for the rule.
at line 171
string
__toString()
Convert the rule to a validation string.