test
This commit is contained in:
@@ -24,7 +24,12 @@ class Screen extends Model
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = [
|
||||
'name', 'path', 'path_thumb', 'size', 'product_id', 'type'
|
||||
'name',
|
||||
'path',
|
||||
'path_thumb',
|
||||
'size',
|
||||
'product_id',
|
||||
'type'
|
||||
];
|
||||
|
||||
/**
|
||||
@@ -53,10 +58,13 @@ class Screen extends Model
|
||||
public function getPath(): string
|
||||
{
|
||||
if (!empty($this->path)) {
|
||||
if (in_array(config('filesystems.default'), ['s3', 'minio'])) {
|
||||
return rtrim(config('filesystems.disks.s3.url'), '/') . '/' . ltrim($this->path, '/');
|
||||
if (in_array(env('FILESYSTEM_DISK'), ['s3', 'minio'])) {
|
||||
return Storage::temporaryUrl(
|
||||
$this->path,
|
||||
Date::now()->addMinutes(5)
|
||||
);
|
||||
}
|
||||
return config('app.url') . '/' . $this->path;
|
||||
return (string) $this->path;
|
||||
}
|
||||
|
||||
return (string) 'image/no_screen.png';
|
||||
@@ -68,10 +76,13 @@ class Screen extends Model
|
||||
public function getPathThumb(): string
|
||||
{
|
||||
if (!empty($this->path_thumb)) {
|
||||
if (in_array(config('filesystems.default'), ['s3', 'minio'])) {
|
||||
return rtrim(config('filesystems.disks.s3.url'), '/') . '/' . ltrim($this->path_thumb, '/');
|
||||
if (in_array(env('FILESYSTEM_DISK'), ['s3', 'minio'])) {
|
||||
return Storage::temporaryUrl(
|
||||
$this->path_thumb,
|
||||
Date::now()->addMinutes(5)
|
||||
);
|
||||
}
|
||||
return config('app.url') . '/' . $this->path_thumb;
|
||||
return (string) $this->path_thumb;
|
||||
}
|
||||
|
||||
return (string) 'image/no_screen_thumb.png';
|
||||
|
||||
Reference in New Issue
Block a user