generated from liutk/owl-admin-base
admin delete
parent
55379ca25a
commit
db7395fe36
|
|
@ -84,7 +84,10 @@ abstract class AdminController extends Controller
|
||||||
try {
|
try {
|
||||||
DB::beginTransaction();
|
DB::beginTransaction();
|
||||||
|
|
||||||
$this->service->delete($ids);
|
$result = $this->service->delete($ids);
|
||||||
|
if ($result === false) {
|
||||||
|
admin_abort($this->service->getError());
|
||||||
|
}
|
||||||
|
|
||||||
DB::commit();
|
DB::commit();
|
||||||
} catch (Throwable $th) {
|
} catch (Throwable $th) {
|
||||||
|
|
|
||||||
|
|
@ -118,15 +118,6 @@ class EmployeeSignRepairService extends BaseService
|
||||||
{
|
{
|
||||||
$list = $this->query()->with(['workflow'])->whereIn('id', explode(',', $ids))->get();
|
$list = $this->query()->with(['workflow'])->whereIn('id', explode(',', $ids))->get();
|
||||||
foreach ($list as $item) {
|
foreach ($list as $item) {
|
||||||
$workflow = $item->workflow;
|
|
||||||
if ($workflow) {
|
|
||||||
if ($workflow->check_status == CheckStatus::Processing) {
|
|
||||||
throw new RuntimeException(CheckStatus::Processing->text() . ', 无法删除');
|
|
||||||
}
|
|
||||||
if ($workflow->check_status == CheckStatus::Success) {
|
|
||||||
throw new RuntimeException(CheckStatus::Success->text() . ', 无法删除');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$item->delete();
|
$item->delete();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -116,9 +116,6 @@ class HolidayApplyService extends BaseService
|
||||||
{
|
{
|
||||||
$list = $this->query()->with(['workflow'])->whereIn('id', explode(',', $ids))->get();
|
$list = $this->query()->with(['workflow'])->whereIn('id', explode(',', $ids))->get();
|
||||||
foreach ($list as $item) {
|
foreach ($list as $item) {
|
||||||
if (!$item->canUpdate()) {
|
|
||||||
return $this->setError('审核中, 无法删除');
|
|
||||||
}
|
|
||||||
$item->delete();
|
$item->delete();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -116,9 +116,6 @@ class OfficalBusinessService extends BaseService
|
||||||
{
|
{
|
||||||
$list = $this->query()->with(['workflow'])->whereIn('id', explode(',', $ids))->get();
|
$list = $this->query()->with(['workflow'])->whereIn('id', explode(',', $ids))->get();
|
||||||
foreach ($list as $item) {
|
foreach ($list as $item) {
|
||||||
if (!$item->canUpdate()) {
|
|
||||||
return $this->setError('审核中, 无法删除');
|
|
||||||
}
|
|
||||||
$item->delete();
|
$item->delete();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -126,9 +126,6 @@ class OvertimeApplyService extends BaseService
|
||||||
{
|
{
|
||||||
$list = $this->query()->with(['workflow'])->whereIn('id', explode(',', $ids))->get();
|
$list = $this->query()->with(['workflow'])->whereIn('id', explode(',', $ids))->get();
|
||||||
foreach ($list as $item) {
|
foreach ($list as $item) {
|
||||||
if (!$item->canUpdate()) {
|
|
||||||
return $this->setError('审核中, 无法删除');
|
|
||||||
}
|
|
||||||
$item->delete();
|
$item->delete();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue