【发布时间】:2021-01-30 20:53:09
【问题描述】:
我正在使用 Postgres 数据库和 laravel 框架 我有 jsonb 字段包含:
{
"patientInfo": {
"id": 1612038632,
"gender": "female",
"lastName": "تست",
"firstName": "تست",
"phoneNumber": "9399999999"
},
"cancelInfo": {
"channel":"Assistant"
}
}
如何编写查询以仅更新患者信息并保持其他键不变? 表名是约会请求,字段名是详细信息。 我写了这个查询,但它需要修复:
AppointmentRequest::where('registerar_id', Auth::guard('PATIENT')->user()->account_id)
->whereRaw(" \"detail->patientInfo\" @> '{\"id\": \"$request->otherPatientId\"}'")
->update(['detail' => ['patientInfo' => json_encode($data)]]);
【问题讨论】:
标签: php laravel postgresql