![](https://box.kancloud.cn/e65f23a169a733e482b072f8b325333b_914x532.png)
~~~
public function saveItem(){
$_data = [
'quantity' => (int) $item->quantity,
'product_id' => (int) $item->product_id,
'purchase_date' => date("Y-m-d H:i:s", ($item->purchase_date_ms / 1000)),
];
$this->model->allowField(true)
->isUpdate(true)
->save($_data, ['id' => $id]);
}
~~~