Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
赵增煜
/
tzt-admin
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
db57011b
authored
Dec 10, 2024
by
赵增煜
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
同步删除药店药品
parent
87c4527c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
4 deletions
+6
-4
app/Admin/Controllers/DrugController.php
+6
-4
No files found.
app/Admin/Controllers/DrugController.php
View file @
db57011b
...
...
@@ -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
();
});
// 右上角按钮控制
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment