Browse Source

namerule和customfile分组返回格式

kely 11 tháng trước cách đây
mục cha
commit
d547775d27
1 tập tin đã thay đổi với 6 bổ sung2 xóa
  1. 6 2
      app/Http/Controllers/API/CustomFieldController.php

+ 6 - 2
app/Http/Controllers/API/CustomFieldController.php

@@ -53,9 +53,13 @@ class CustomFieldController extends Controller
         $nameRuleGroups=NamingRule::query()->get()->pluck('id')->toArray();
         $allGroups=config("custom-field.groups");
 
-
         if(!empty($nameRuleGroups)){
-            $notNameRule=collect(array_diff($allGroups,$nameRuleGroups))->toArray();
+            $notNameRule = [];
+            foreach ($allGroups as $group) {
+                if (!in_array($group, $nameRuleGroups)) {
+                    $notNameRule[] = $group;
+                }
+            }
             return $this->success([
                 'data' => $notNameRule
             ]);