Code Duplication    Length = 19-21 lines in 2 locations

src/Form/Elements/Tree.php 1 location

@@ 185-203 (lines=19) @@
182
    /**
183
     * @return Model
184
     */
185
    protected function getNodesModel()
186
    {
187
        $model = $this->nodes;
188
189
        if (is_string($model)) {
190
            $model = app($model);
191
        }
192
193
        if (! ($model instanceof Model)) {
194
            throw new InvalidArgumentException(
195
                sprintf(
196
                    "Form tree element's nodes class must be instanced of '%s'.",
197
                    Model::class
198
                )
199
            );
200
        }
201
202
        return $model;
203
    }
204
205
    public function getNodesModelLabelAttribute()
206
    {

src/Traits/SelectOptionsFromModel.php 1 location

@@ 73-93 (lines=21) @@
70
     *
71
     * @return Model
72
     */
73
    public function getOptionsModel()
74
    {
75
        $model = $this->options;
76
77
        if (is_string($model)) {
78
            $model = app($model);
79
        }
80
81
        if (! ($model instanceof Model)) {
82
            throw new InvalidArgumentException(
83
                sprintf(
84
                    'The %s element[%s] options class must be instanced of "%s".',
85
                    $this->getType(),
86
                    $this->getName(),
87
                    Model::class
88
                )
89
            );
90
        }
91
92
        return $model;
93
    }
94
95
    protected function isOptionsModel()
96
    {