How to update model by import? #3587
Unanswered
alejandromora99
asked this question in
Q&A
Replies: 1 comment
-
It Laravel tries an insert, it most likely means there's no product with that name yet. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I am trying to update my products model by importing from laravel-excel, here the class:
When trying this I get the error:
SQLSTATE[HY000]: General error: 1364 Field 'trademark' doesn't have a default value (SQL: insert into
products(
cost,
created_at,
name,
price,
stock,
updated_at) values (500, 2022-03-23 19:47:43, Assumenda qui rerum., 9990, 4, 2022-03-23 19:47:43) on duplicate key update
stock= values(
stock),
price= values(
price),
cost= values(
cost),
updated_at= values(
updated_at))
I don't understand why it keeps trying to insert new data if I'm using "WithUpserts", what am I doing wrong?
Beta Was this translation helpful? Give feedback.
All reactions