Code Duplication    Length = 13-13 lines in 2 locations

src/Form/Elements/MultiSelect.php 1 location

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

src/Form/Elements/Tree.php 1 location

@@ 67-79 (lines=13) @@
64
        }
65
    }
66
67
    public function finishSave()
68
    {
69
        if (! ($this->isNodesModel() && $this->isRelation())) {
70
            return;
71
        }
72
        $attribute = $this->getName();
73
        $values = $this->getValueFromRequest();
74
75
        $relation = $this->getModel()->{$attribute}();
76
        if ($relation instanceof BelongsToMany) {
77
            $relation->sync($values);
78
        }
79
    }
80
81
    protected function isNodesModel()
82
    {