|
@@ -51,21 +51,7 @@ class CustomFieldController extends Controller
|
|
|
|
|
|
public function groups()
|
|
|
{
|
|
|
- $nameRuleGroups=NamingRule::query()->get()->pluck('id')->toArray();
|
|
|
$allGroups=config("custom-field.groups");
|
|
|
-
|
|
|
- if(!empty($nameRuleGroups)){
|
|
|
- $notNameRule = [];
|
|
|
- foreach ($allGroups as $group) {
|
|
|
- if (!in_array($group, $nameRuleGroups)) {
|
|
|
- $notNameRule[] = $group;
|
|
|
- }
|
|
|
- }
|
|
|
- return $this->success([
|
|
|
- 'data' => $notNameRule
|
|
|
- ]);
|
|
|
- }
|
|
|
-
|
|
|
return $this->success([
|
|
|
'data'=> $allGroups
|
|
|
]);
|
|
@@ -75,13 +61,6 @@ class CustomFieldController extends Controller
|
|
|
{
|
|
|
$nameGroupId=$request->get('nameGroupId');
|
|
|
$nameRuleGroup = NamingRule::query()->where('id',$nameGroupId)->get();
|
|
|
- $allGroups=config("custom-field.groups");
|
|
|
- if(!empty($nameRuleGroup)){
|
|
|
- //array_intersect 函数,它返回两个数组的交集
|
|
|
- if(empty(array_intersect($allGroups,$nameRuleGroup->pluck('id')->toArray()))){
|
|
|
- throw new \Exception("Please contact the administrator to add the namerule configuration.");
|
|
|
- }
|
|
|
- }
|
|
|
|
|
|
return NamingRuleSimpleResource::collection($nameRuleGroup);
|
|
|
}
|