Code Duplication    Length = 7-7 lines in 2 locations

src/Grid/Displayers/Image.php 1 location

@@ 18-24 (lines=7) @@
15
        }
16
17
        return collect((array) $this->value)->filter()->map(function ($path) use ($server, $width, $height, $expand) {
18
            if (url()->isValidUrl($path)) {
19
                $src = $path;
20
            } elseif ($server) {
21
                $src = $server.$path;
22
            } else {
23
                $src = Storage::disk(config('admin.upload.disk'))->url($path);
24
            }
25
26
            if ($expand) Admin::script("$('img.img-expand').on('click', function() { $('.img-expanded').attr('src', $(this).attr('src')); $('#img-expand-" . $this->getKey() . "').modal('show'); });");
27
            return ($expand?'<div class="modal fade" id="img-expand-' . $this->getKey() . '" tabindex="-1" role="dialog" aria-labelledby="img-expand" aria-hidden="true"><div class="modal-dialog modal-lg" role="document"><div class="modal-content"><div class="modal-body"><img src="" class="img-expanded" style="width: 100%;"></div></div></div></div>':'') . "<img src='$src' style='max-width:{$width}px;max-height:{$height}px' class='img img-thumbnail" . ($expand?' img-expand':'') . "' />";

src/Show/Field.php 1 location

@@ 248-254 (lines=7) @@
245
                $url = $path;
246
            } elseif ($server) {
247
                $url = $server.$path;
248
            } else {
249
                $storage = Storage::disk(config('admin.upload.disk'));
250
                if ($storage->exists($path)) {
251
                    $url = $storage->url($path);
252
                    $size = ($storage->size($path) / 1000).'KB';
253
                }
254
            }
255
256
            return <<<HTML
257
<ul class="mailbox-attachments clearfix">