From 6a91d4d19ea223d969302984463ffbac561880aa Mon Sep 17 00:00:00 2001 From: snipe Date: Wed, 16 Feb 2022 13:46:22 -0800 Subject: [PATCH] Check for uniqueness constraint Signed-off-by: snipe --- app/Models/CustomFieldset.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/Models/CustomFieldset.php b/app/Models/CustomFieldset.php index bcbe0b81d9..1cf1807d85 100644 --- a/app/Models/CustomFieldset.php +++ b/app/Models/CustomFieldset.php @@ -83,7 +83,11 @@ class CustomFieldset extends Model if (($field->field_encrypted != '1') || (($field->field_encrypted == '1') && (Gate::allows('admin')))) { - $rule[] = ($field->pivot->required == '1') ? 'required' : 'nullable'; + $rule[] = ($field->pivot->required == '1') ? 'required' : 'nullable'; + } + + if ($field->is_unique == '1') { + $rule[] = 'unique'; } array_push($rule, $field->attributes['format']);