Code Duplication    Length = 12-12 lines in 2 locations

src/Show/Field.php 2 locations

@@ 283-294 (lines=12) @@
280
     *
281
     * @return Field
282
     */
283
    public function label($style = 'success')
284
    {
285
        return $this->as(function ($value) use ($style) {
286
            if ($value instanceof Arrayable) {
287
                $value = $value->toArray();
288
            }
289
290
            return collect((array) $value)->map(function ($name) use ($style) {
291
                return "<span class='label label-{$style}'>$name</span>";
292
            })->implode('&nbsp;');
293
        });
294
    }
295
296
    /**
297
     * Show field as badges.
@@ 303-314 (lines=12) @@
300
     *
301
     * @return Field
302
     */
303
    public function badge($style = 'blue')
304
    {
305
        return $this->as(function ($value) use ($style) {
306
            if ($value instanceof Arrayable) {
307
                $value = $value->toArray();
308
            }
309
310
            return collect((array) $value)->map(function ($name) use ($style) {
311
                return "<span class='badge bg-{$style}'>$name</span>";
312
            })->implode('&nbsp;');
313
        });
314
    }
315
316
    /**
317
     * Show field as json code.