Reputation: 4539
Hello guys,
I'm making an API using Laravel. In one of my scripts, I make an update on a field, like this :
user::where('uuid', $uuid)->update(['date' => $date]);
I noticed that the primary key increments when doing this. My obvious conclusion is that Eloquent makes a delete - insert in place of a regular MySQL update.
And so the question is, why ?
Thanks ahead.
Upvotes: 5
Views: 570
Reputation: 111829
It's not possible that this line of code will update id your records. Whenever you thing something strange happens in your application (not only in Laravel), you should:
user
modelUpvotes: 1