Code Duplication    Length = 13-13 lines in 2 locations

src/Form/Elements/Tree.php 1 location

@@ 61-73 (lines=13) @@
58
        }
59
    }
60
61
    public function finishSave()
62
    {
63
        if (! ($this->isNodesModel() && $this->isRelation())) {
64
            return;
65
        }
66
        $attribute = $this->getName();
67
        $values = $this->getValueFromRequest();
68
69
        $relation = $this->getModel()->{$attribute}();
70
        if ($relation instanceof BelongsToMany) {
71
            $relation->sync($values);
72
        }
73
    }
74
75
    protected function isNodesModel()
76
    {

src/Form/Elements/MultiSelect.php 1 location

@@ 58-70 (lines=13) @@
55
        }
56
    }
57
58
    public function finishSave()
59
    {
60
        if (! ($this->isOptionsModel() && $this->isRelation())) {
61
            return;
62
        }
63
        $attribute = $this->getName();
64
        $values = $this->getValueFromRequest();
65
66
        $relation = $this->getModel()->{$attribute}();
67
        if ($relation instanceof BelongsToMany) {
68
            $relation->sync($values);
69
        }
70
    }
71
72
    protected function isRelation()
73
    {