This commit is contained in:
2026-04-16 03:34:16 +05:00
parent 6a4221f0a5
commit eea40876a4
13 changed files with 108 additions and 76 deletions

View File

@@ -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';