diff --git a/app/Form/Tag.php b/app/Form/Tag.php index 330b85595..d13cdfd07 100644 --- a/app/Form/Tag.php +++ b/app/Form/Tag.php @@ -78,8 +78,11 @@ public function fields() */ public function rules() { + // Tag to exclude in unique test while editing + $excludeTag = $this->isEditing()? ',' . $this->getModel()->id : ''; + $rules = [ - 'name' => 'required|max:200', + 'name' => 'required|max:200|unique:tags,name' . $excludeTag, 'parent_id' => 'required', 'bgcolor' => 'required', ];