소스 검색

namerule配置存在判断修改

kely 11 달 전
부모
커밋
11387b6899
1개의 변경된 파일2개의 추가작업 그리고 1개의 파일을 삭제
  1. 2 1
      app/Http/Controllers/API/CustomFieldController.php

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

@@ -77,7 +77,8 @@ class CustomFieldController extends Controller
         $nameRuleGroup = NamingRule::query()->where('id',$nameGroupId)->get();
         $allGroups=config("custom-field.groups");
         if(!empty($nameRuleGroup)){
-            if(!in_array($allGroups,$nameRuleGroup->pluck('id')->toArray())){
+            //array_intersect 函数,它返回两个数组的交集
+            if(empty(array_intersect($allGroups,$nameRuleGroup->pluck('id')->toArray()))){
                 throw new \Exception("Please contact the administrator to add the namerule configuration.");
             }
         }