diff --git a/src/Console/ModelsCommand.php b/src/Console/ModelsCommand.php index 395cf9d79..93a1f04c5 100644 --- a/src/Console/ModelsCommand.php +++ b/src/Console/ModelsCommand.php @@ -1048,6 +1048,11 @@ protected function createPhpDocs($class) $tagLine = trim("@{$attr} {$property['type']} {$name} {$property['comment']}"); $tag = Tag::createInstance($tagLine, $phpdoc); + + if ($this->tagExists($phpdoc, $tag)) { + continue; + } + $phpdoc->appendTag($tag); } @@ -1762,4 +1767,19 @@ protected function setForeignKeys($schema, $table) } } } + + /** + * @param DocBlock $phpdoc + * @param Tag $tag + */ + public function tagExists($phpdoc, $tag): bool + { + foreach ($phpdoc->getTags() as $originalTag) { + if ($originalTag->getContent() == $tag->getContent()) { + return true; + } + } + + return false; + } }