In my laravel 5.6 application I use next rule to check unique for name field
'name' => [
'required',
'string',
'max:255',
Rule::unique('votes')->ignore($vote_id),
],
I use ignore condition to update this vote.
But I have a table where field “name” is unique inside of any "vote_id" :
CREATE TABLE "vote_items"
"id" integer not null primary key autoincrement,
"vote_id" integer null,
"name" varchar not null,
Can I use unique checks condition in such cases and if yes which syntax is correct?
Thanks!
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2PjkD8u
via IFTTT
Aucun commentaire:
Enregistrer un commentaire