1 | <?php |
||
2 | |||
3 | namespace UniSharp\Uploadable; |
||
4 | |||
5 | use Illuminate\Support\Facades\URL; |
||
6 | |||
7 | class Image extends File |
||
0 ignored issues
–
show
Coding Style
Documentation
introduced
by
![]() |
|||
8 | { |
||
9 | protected $table = 'files'; |
||
0 ignored issues
–
show
|
|||
10 | |||
11 | protected $appends = ['thumb']; |
||
0 ignored issues
–
show
|
|||
12 | |||
13 | public function getThumbAttribute(): array |
||
14 | { |
||
15 | 2 | return collect(['s', 'm', 'l'])->flip()->map(function ($_, $size) { |
|
16 | 2 | return URL::to(preg_replace('/^(images\/)/', "\$1{$size}/", $this->attributes['path'])); |
|
17 | 2 | })->toArray(); |
|
18 | } |
||
19 | } |
||
20 |