test
This commit is contained in:
@@ -63,8 +63,12 @@ class Brand extends Model
|
||||
{
|
||||
if (!empty($this->image)) {
|
||||
if (in_array(config('filesystems.default'), ['s3', 'minio'])) {
|
||||
return rtrim(config('filesystems.disks.s3.url'), '/') . '/' . ltrim($this->image, '/');
|
||||
return Storage::temporaryUrl(
|
||||
$this->image,
|
||||
Date::now()->addMinutes(5)
|
||||
);
|
||||
}
|
||||
;
|
||||
|
||||
return (string) '/' . $this->image;
|
||||
}
|
||||
|
||||
@@ -148,7 +148,10 @@ class Category extends Model
|
||||
{
|
||||
if (!in_array($this->image, ['null', null])) {
|
||||
if (in_array(config('filesystems.default'), ['s3', 'minio'])) {
|
||||
return rtrim(config('filesystems.disks.s3.url'), '/') . '/' . ltrim($this->image, '/');
|
||||
return Storage::temporaryUrl(
|
||||
$this->image,
|
||||
Date::now()->addMinutes(5)
|
||||
);
|
||||
}
|
||||
|
||||
return config('app.url') . '/' . $this->image;
|
||||
|
||||
@@ -237,7 +237,10 @@ class Product extends Model
|
||||
{
|
||||
if (!empty($this->poster)) {
|
||||
if (in_array(config('filesystems.default'), ['s3', 'minio'])) {
|
||||
return rtrim(config('filesystems.disks.s3.url'), '/') . '/' . ltrim($this->poster, '/');
|
||||
return Storage::temporaryUrl(
|
||||
$this->poster,
|
||||
Date::now()->addMinutes(5)
|
||||
);
|
||||
}
|
||||
return config('app.url') . '/' . $this->poster;
|
||||
}
|
||||
@@ -249,7 +252,10 @@ class Product extends Model
|
||||
{
|
||||
if (!empty($this->data_sheet) and ($this->data_sheet != null and $this->data_sheet != "null")) {
|
||||
if (in_array(config('filesystems.default'), ['s3', 'minio'])) {
|
||||
return rtrim(config('filesystems.disks.s3.url'), '/') . '/' . ltrim($this->data_sheet, '/');
|
||||
return Storage::temporaryUrl(
|
||||
$this->data_sheet,
|
||||
Date::now()->addMinutes(5)
|
||||
);
|
||||
}
|
||||
return config('app.url') . '/' . $this->data_sheet;
|
||||
}
|
||||
@@ -260,7 +266,10 @@ class Product extends Model
|
||||
{
|
||||
if (!empty($this->poster_thumb)) {
|
||||
if (in_array(config('filesystems.default'), ['s3', 'minio'])) {
|
||||
return rtrim(config('filesystems.disks.s3.url'), '/') . '/' . ltrim($this->poster_thumb, '/');
|
||||
return Storage::temporaryUrl(
|
||||
$this->poster_thumb,
|
||||
Date::now()->addMinutes(5)
|
||||
);
|
||||
}
|
||||
return config('app.url') . '/' . $this->poster_thumb;
|
||||
}
|
||||
|
||||
@@ -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