Code Duplication    Length = 19-20 lines in 2 locations

src/Form/Elements/Select.php 1 location

@@ 122-141 (lines=20) @@
119
    /**
120
     * @return Model
121
     */
122
    public function getOptionsModel()
123
    {
124
        $model = $this->options;
125
126
        if (is_string($model)) {
127
            $model = app($model);
128
        }
129
130
        if (!($model instanceof Model)) {
131
            throw new InvalidArgumentException(
132
                sprintf(
133
                    'Form %s element options class must be instanced of "%s".',
134
                    $this->getType(),
135
                    Model::class
136
                )
137
            );
138
        }
139
140
        return $model;
141
    }
142
143
    /**
144
     * 获取 options 标题字段

src/Form/Elements/Tree.php 1 location

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