Skip to content

Commit 61c7daf

Browse files
committed
Issue
1 parent 1d2e602 commit 61c7daf

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

packages/Webkul/Admin/src/Http/Controllers/Settings/GroupController.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,12 @@ public function destroy(int $id): JsonResponse
102102
{
103103
$group = $this->groupRepository->findOrFail($id);
104104

105+
if ($group->users()->exists()) {
106+
return response()->json([
107+
'message' => trans('admin::app.settings.groups.index.delete-failed-associated-users'),
108+
], 400);
109+
}
110+
105111
try {
106112
Event::dispatch('settings.group.delete.before', $id);
107113

packages/Webkul/Admin/src/Resources/lang/en/app.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -746,12 +746,13 @@
746746

747747
'groups' => [
748748
'index' => [
749-
'create-btn' => 'Create Group',
750-
'title' => 'Groups',
751-
'create-success' => 'Group created successfully.',
752-
'update-success' => 'Group updated successfully.',
753-
'destroy-success' => 'Group deleted successfully.',
754-
'delete-failed' => 'Group can not be deleted.',
749+
'create-btn' => 'Create Group',
750+
'title' => 'Groups',
751+
'create-success' => 'Group created successfully.',
752+
'update-success' => 'Group updated successfully.',
753+
'destroy-success' => 'Group deleted successfully.',
754+
'delete-failed' => 'Group can not be deleted.',
755+
'delete-failed-associated-users' => 'Group can not be deleted, as this is being used by users.',
755756

756757
'datagrid' => [
757758
'delete' => 'Delete',

0 commit comments

Comments
 (0)