尝试使用SQL插入表时,Laravel / React在我需要使用下划线作为列名的同时添加了一个点

问题描述

我正在使用React&Laravel开发一个应用程序,并且试图将user_id与order_item链接起来。我得到的全部错误

`"message": "sqlSTATE[42S22]: Column not found: 1054 UnkNown column 'bestellingen.id' in 'where clause' (sql: select * from "bestellingen" where "bestellingen"."id" = oRPCiPfwNL5Dx limit 1)"`. So it's looking for a column called `bestellingen.id` while my column in the db is named `bestellingen_id`

我尝试查找列的方式是这样的:

let bestellingKoppeling = {
klant_id: json.data.klant,bestel_id: this.props.finalOrder['bestelling_id_order'] 
}

然后我用AXIOS.post("http://localhost:8000/api/koppelklantbestelling",bestellingKoppeling)去Laravel并

public function storeBestelling(Request $request) {

    $bestelling = Bestellingen::find($request->bestel_id);

    $bestelling->klant_id = $request->klant_id;

    $bestelling->save();
    return $bestelling;
}`

我运行实际命令从数据库获取项目并更新user_id(klant_id)列。 有帮助吗?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)