Commit db57011b by 赵增煜

同步删除药店药品

parent 87c4527c
......@@ -161,10 +161,12 @@ protected function form()
$form->deleting(function (Form $form) {
// 获取待删除行数据,这里获取的是一个二维数组
$drugId = $form->getKey();
$num = PharmacyDrugModel::where('drug_id', $drugId)->count();
if ($num >= 1) {
return $form->response()->error('该药品已经被也药店导入,暂时不能删除~');
}
// $num = PharmacyDrugModel::where('drug_id', $drugId)->count();
// if ($num >= 1) {
// return $form->response()->error('该药品已经被也药店导入,暂时不能删除~');
// }
// 同步删除关联表数据
PharmacyDrugModel::where('drug_id', $drugId)->delete();
});
// 右上角按钮控制
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment