0

我在更新功能中使用了它:

 $qty = $request->input('checked_out_qty');
    DB::table('consumables')->decrement('remaining_qty',$qty );

我不断收到此错误:

“SQLSTATE [23000]:完整性约束违规:1452 无法添加或更新子行:外键约束失败(fixed. , consumables_historiesCONSTRAINT 251075_5c35eb169cb40FOREIGN KEY ( checked_out_qty_id) REFERENCES consumables( ) ON DELETE CASCADE )( SQL :id插入consumables_historiesconsumables_id,,,,,,, , , ) 值 (1368, 6, 1, 1, 1, , 2019-02-03 08:08:34, 2019-02-03 08:08:34))checked_out_qty_idchecked_out_by_idstatus_idlocation_idassigned_to_idupdated_atcreated_at

但是当你第二次刷新时,减量仍然发生。我做错了什么?

4

0 回答 0