My understanding of Laravel updateOrCreate is that if a given value exists updates the table otherwise adds a new record but I have encounter as situation that instead of updating it give me the duplicate error. This is what I have:
$e = \App\Element::updateOrCreate(
['link' => $link],
['title'=>$title,'description' => $description]
This works fine but for one record I get:
SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'blahblahblah' for key 'link'
I wonder why updateOrCreate doesn't work here as it should. Shouldn't it leave the link
column as it is and update the rest?
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2n23y4s
via IFTTT
Aucun commentaire:
Enregistrer un commentaire