|
@@ -10,6 +10,7 @@ use App\Models\CustomField;
|
|
|
use App\Models\NamingRule;
|
|
|
use Illuminate\Http\Request;
|
|
|
use Illuminate\Support\Facades\Auth;
|
|
|
+use function Nette\Utils\isEmpty;
|
|
|
|
|
|
class CustomFieldController extends Controller
|
|
|
{
|
|
@@ -70,19 +71,18 @@ class CustomFieldController extends Controller
|
|
|
]);
|
|
|
}
|
|
|
|
|
|
- public function nameRuleGroups()
|
|
|
+ public function nameRuleGroups(Request $request)
|
|
|
{
|
|
|
- $nameRuleGroupsIds = NamingRule::query()->pluck('id')->toArray();
|
|
|
- $allGroups = config("custom-field.groups");
|
|
|
-
|
|
|
- $intersectIds = array_intersect($allGroups, $nameRuleGroupsIds);
|
|
|
-
|
|
|
- if (empty($intersectIds)) {
|
|
|
- return $this->success([]);
|
|
|
+ $nameGroupId=$request->get('nameGroupId');
|
|
|
+ $nameRuleGroup = NamingRule::query()->where('id',$nameGroupId)->get();
|
|
|
+ $allGroups=config("custom-field.groups");
|
|
|
+ if(!empty($nameRuleGroup)){
|
|
|
+ if(in_array($allGroups,$nameRuleGroup->pluck('id')->toArray())){
|
|
|
+ throw new \Exception("Please contact the administrator to add the namerule configuration.");
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
- $inGroups = NamingRule::query()->whereIn('id', $intersectIds)->get();
|
|
|
- return NamingRuleSimpleResource::collection($inGroups);
|
|
|
+ return NamingRuleSimpleResource::collection($nameRuleGroup);
|
|
|
}
|
|
|
|
|
|
|