Code Duplication    Length = 12-12 lines in 2 locations

src/Show/Field.php 2 locations

@@ 199-210 (lines=12) @@
196
     *
197
     * @return Field
198
     */
199
    public function label($style = 'success')
200
    {
201
        return $this->as(function ($value) use ($style) {
202
            if ($value instanceof Arrayable) {
203
                $value = $value->toArray();
204
            }
205
206
            return collect((array) $value)->map(function ($name) use ($style) {
207
                return "<span class='label label-{$style}'>$name</span>";
208
            })->implode('&nbsp;');
209
        });
210
    }
211
212
    /**
213
     * Show field as badges.
@@ 219-230 (lines=12) @@
216
     *
217
     * @return Field
218
     */
219
    public function badge($style = 'blue')
220
    {
221
        return $this->as(function ($value) use ($style) {
222
            if ($value instanceof Arrayable) {
223
                $value = $value->toArray();
224
            }
225
226
            return collect((array) $value)->map(function ($name) use ($style) {
227
                return "<span class='badge bg-{$style}'>$name</span>";
228
            })->implode('&nbsp;');
229
        });
230
    }
231
232
    /**
233
     * Set value for this field.