Laravel 4: uniqueness check (database) several where items

The laravel 4 documentation mentions a unique field check. They explain here how to include unique verification offers. A separate WHERE clause for a unique table, for example:

$validator = Validator::make(
    array(
        'name' => 'John Doe'
    ),
    array(
        'name' => 'unique:table,field,NULL,id,field1,value1'
    )
);

Now I assume this does something like:

"SELECT id FROM table WHERE field = 'John Doe' AND field1 = value1 LIMIT 1"

Then check if this query returns a result, and if it did not pass the test.

So, I was wondering if there is a way to add more suggestions? And if so, how?

+4
source share
1 answer

End of my original question:

, ? ", field2, value2, field3, value3" ect. ?

, , . , where , :

'name' => 'unique:table,field,NULL,id,field1,value1,field2,value2,field3,value3'


, , except, Laravel.

unique:table,column,except,idColumn

NULL, . , , NULL , :

except . NULL (.. ).

: , , , . , admin - , , 1. :

'name' => 'unique:users,email,1,id'
+9

All Articles