File tree Expand file tree Collapse file tree 2 files changed +13
-6
lines changed
packages/Webkul/Admin/src
Http/Controllers/Settings Expand file tree Collapse file tree 2 files changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -102,6 +102,12 @@ public function destroy(int $id): JsonResponse
102
102
{
103
103
$ group = $ this ->groupRepository ->findOrFail ($ id );
104
104
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
+
105
111
try {
106
112
Event::dispatch ('settings.group.delete.before ' , $ id );
107
113
Original file line number Diff line number Diff line change 746
746
747
747
'groups ' => [
748
748
'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. ' ,
755
756
756
757
'datagrid ' => [
757
758
'delete ' => 'Delete ' ,
You can’t perform that action at this time.
0 commit comments