我有订单表,我需要获取Original订单的值以便管理员更改它:我使用getOriginal和getAttributes()['column_name']总是存储相同的状态值:( $order->update([ 'status' => $request->status ]); $order->orders_status_reports()->attach($order->id,[ 'old_status' => $order->getOriginal('status'), 'new_status' => $order->status, ]);
1 回答
蝴蝶不菲
TA贡献1810条经验 获得超4个赞
您可以在更新订单之前附加旧状态:
$new_status = $request->status;
$order->orders_status_reports()->attach($order->id,[
'old_status' => $order->status,
'new_status' => $new_status,
]);
$order->update(['status' => $new_status]);
- 1 回答
- 0 关注
- 130 浏览
添加回答
举报
0/150
提交
取消