Code Duplication    Length = 13-13 lines in 2 locations

src/Form/Elements/MultiSelect.php 1 location

@@ 36-48 (lines=13) @@
33
        }
34
    }
35
36
    public function finishSave()
37
    {
38
        if (! ($this->isOptionsModel() && $this->isRelation())) {
39
            return;
40
        }
41
        $attribute = $this->getName();
42
        $values = $this->getValueFromRequest();
43
44
        $relation = $this->getModel()->{$attribute}();
45
        if ($relation instanceof BelongsToMany) {
46
            $relation->sync($values);
47
        }
48
    }
49
50
    protected function isRelation()
51
    {

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
    {