Code Duplication    Length = 19-21 lines in 2 locations

src/Form/Elements/Tree.php 1 location

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

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
    {