Code Duplication    Length = 13-13 lines in 2 locations

src/Form/Elements/Tree.php 1 location

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

src/Form/Elements/MultiSelect.php 1 location

@@ 42-54 (lines=13) @@
39
        }
40
    }
41
42
    public function finishSave()
43
    {
44
        if (! ($this->isOptionsModel() && $this->isRelation())) {
45
            return;
46
        }
47
        $attribute = $this->getName();
48
        $values = $this->getValueFromRequest();
49
50
        $relation = $this->getModel()->{$attribute}();
51
        if ($relation instanceof BelongsToMany) {
52
            $relation->sync($values);
53
        }
54
    }
55
56
    protected function isRelation()
57
    {