Unique
class Unique (View source)
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
void | __construct(string $table, string $column = 'NULL') Create a new unique rule instance. | |
$this | where(string $column, string $value = null) Set a "where" constraint on the query. | |
$this | whereNot(string $column, string $value) Set a "where not" constraint on the query. | |
$this | whereNull(string $column) Set a "where null" constraint on the query. | |
$this | whereNotNull(string $column) Set a "where not null" constraint on the query. | |
$this | ignore(mixed $id, string $idColumn = 'id') Ignore the given ID during the unique check. | |
$this | using(Closure $callback) Register a custom query callback. | |
string | formatWheres() Format the where clauses. | |
array | queryCallbacks() Get the custom query callbacks for the rule. | |
string | __toString() Convert the rule to a validation string. |
Details
void __construct(string $table, string $column = 'NULL')
Create a new unique rule instance.
$this where(string $column, string $value = null)
Set a "where" constraint on the query.
$this whereNot(string $column, string $value)
Set a "where not" constraint on the query.
$this whereNull(string $column)
Set a "where null" constraint on the query.
$this whereNotNull(string $column)
Set a "where not null" constraint on the query.
$this ignore(mixed $id, string $idColumn = 'id')
Ignore the given ID during the unique check.
$this using(Closure $callback)
Register a custom query callback.
protected string formatWheres()
Format the where clauses.
array queryCallbacks()
Get the custom query callbacks for the rule.
string __toString()
Convert the rule to a validation string.
© Taylor Otwell
Licensed under the MIT License.
Laravel is a trademark of Taylor Otwell.
https://laravel.com/api/5.3/Illuminate/Validation/Rules/Unique.html