Code Duplication    Length = 5-5 lines in 2 locations

app/Model/Traits/Project/CrudTrait.php 1 location

@@ 115-119 (lines=5) @@
112
        // Save tags
113
        $kanbanTags = $this->kanbanTags();
114
        $count      = $tags->count();
115
        foreach ($tags as $position => $tag) {
116
            $position = $tag->name === Tag::STATUS_OPEN ? -1 : $position;
117
            $position = $tag->name === Tag::STATUS_CLOSED ? $count + 1 : $position;
118
            $kanbanTags->attach([$tag->id => ['position' => $position]]);
119
        }
120
121
        return true;
122
    }

app/Model/Traits/Project/QueryTrait.php 1 location

@@ 184-188 (lines=5) @@
181
        if (!$tags->count()) {
182
            $tags       = (new Tag())->getOpenAndCloseTags();
183
            $kanbanTags = $this->kanbanTags();
184
            foreach ($tags as $position => $tag) {
185
                $position = $tag->name === Tag::STATUS_OPEN ? -1 : $position;
186
                $position = $tag->name === Tag::STATUS_CLOSED ? 100 : $position;
187
                $kanbanTags->attach([$tag->id => ['position' => $position]]);
188
            }
189
        }
190
191
        return $tags;