Code Duplication    Length = 19-19 lines in 2 locations

src/Form/Elements/Tree.php 1 location

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

src/Traits/SelectOptionsFromModel.php 1 location

@@ 73-91 (lines=19) @@
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 select options class must be instanced of "%s".',
85
                    Model::class
86
                )
87
            );
88
        }
89
90
        return $model;
91
    }
92
93
    /**
94
     * Get the options from model.