storage url o'zgartirildi

This commit is contained in:
2026-04-28 15:02:06 +05:00
parent 3aa4601229
commit bb733d14c1
37 changed files with 282 additions and 407 deletions

View File

@@ -62,12 +62,7 @@ class Brand extends Model
public function getImage(): string
{
if (!empty($this->image)) {
if (in_array(config('filesystems.default'), ['s3', 'minio'])) {
return Storage::url($this->image);
}
;
return (string) '/' . $this->image;
return Storage::url($this->image);
}
return (string) 'images/no_brend.png';

View File

@@ -147,11 +147,7 @@ class Category extends Model
public function getImage(): string
{
if (!in_array($this->image, ['null', null])) {
if (in_array(config('filesystems.default'), ['s3', 'minio'])) {
return Storage::url($this->image);
}
return config('app.url') . '/' . $this->image;
return Storage::url($this->image);
}
return config('app.url') . '/images/nophoto.jpg';

View File

@@ -58,6 +58,11 @@ class Compilation extends Model
return $this->belongsToMany(Product::class, 'compilation_products')->where('published', true)->limit(10);
}
public function dashboardProducts()
{
return $this->belongsToMany(Product::class, 'compilation_products');
}
/**

View File

@@ -30,12 +30,9 @@ class ContractTemplate extends Model
public function full_path(): string
{
if (!empty($this->path)) {
if (in_array(env('FILESYSTEM_DISK'), ['s3', 'minio'])) {
return Storage::url($this->path);
}
return '/' . $this->path;
return Storage::url($this->path);
}
return asset('storage/' . $this->path);
return null;
}
}

View File

@@ -47,10 +47,7 @@ class File extends Model
public function getPath()
{
if (!empty($this->path)) {
if (in_array(env('FILESYSTEM_DISK'), ['s3', 'minio'])) {
return Storage::url($this->path);
}
return (string) $this->path;
return Storage::url($this->path);
}
return null;
@@ -62,10 +59,7 @@ class File extends Model
public function getPathThumb()
{
if (!empty($this->path_thumb)) {
if (in_array(env('FILESYSTEM_DISK'), ['s3', 'minio'])) {
return Storage::url($this->path_thumb);
}
return (string) $this->path_thumb;
return Storage::url($this->path_thumb);
}
return null;

View File

@@ -36,11 +36,7 @@ class OrderContract extends Model
public function getPath()
{
if (!empty($this->path)) {
if (in_array(env('FILESYSTEM_DISK'), ['s3', 'minio'])) {
return Storage::url($this->path);
}
return env('APP_URL') . '/storage/' . $this->path;
return Storage::url($this->path);
}
return null;

View File

@@ -52,11 +52,7 @@ class Partner extends Model
public function getImage(): string
{
if (!empty($this->image)) {
if (in_array(env('FILESYSTEM_DISK'), ['s3', 'minio'])) {
return Storage::url($this->image);
}
return (string) $this->image;
return Storage::url($this->image);
}
return (string) 'images/no_brend.png';

View File

@@ -70,11 +70,7 @@ class PaymentSystemItem extends Model
public function getLogo(): string
{
if (!empty($this->logo)) {
if (in_array(env('FILESYSTEM_DISK'), ['s3', 'minio'])) {
return Storage::url($this->logo);
}
return env('APP_URL').'/'.$this->logo;
return Storage::url($this->logo);
}
return '/images/nophoto.jpg';

View File

@@ -56,11 +56,7 @@ class Post extends Model
public function getImage(): string
{
if (!empty($this->image)) {
if (in_array(env('FILESYSTEM_DISK'), ['s3', 'minio'])) {
return Storage::url($this->image);
}
return $this->image;
return Storage::url($this->image);
}
return '/images/nophoto.jpg';

View File

@@ -236,10 +236,7 @@ class Product extends Model
public function getPoster(): string
{
if (!empty($this->poster)) {
if (in_array(config('filesystems.default'), ['s3', 'minio'])) {
return Storage::url($this->poster);
}
return config('app.url') . '/' . $this->poster;
return Storage::url($this->poster);
}
return config('app.url') . '/images/no_product.jpg';
@@ -248,10 +245,7 @@ class Product extends Model
public function getDataSheet()
{
if (!empty($this->data_sheet) and ($this->data_sheet != null and $this->data_sheet != "null")) {
if (in_array(config('filesystems.default'), ['s3', 'minio'])) {
return Storage::url($this->data_sheet);
}
return config('app.url') . '/' . $this->data_sheet;
return Storage::url($this->data_sheet);
}
return null;
}
@@ -259,10 +253,7 @@ class Product extends Model
public function getPosterThumb(): string
{
if (!empty($this->poster_thumb)) {
if (in_array(config('filesystems.default'), ['s3', 'minio'])) {
return Storage::url($this->poster_thumb);
}
return config('app.url') . '/' . $this->poster_thumb;
return Storage::url($this->poster_thumb);
}
return config('app.url') . '/images/no_product.jpg';

View File

@@ -58,10 +58,7 @@ class Screen extends Model
public function getPath(): string
{
if (!empty($this->path)) {
if (in_array(env('FILESYSTEM_DISK'), ['s3', 'minio'])) {
return Storage::url($this->path);
}
return (string) $this->path;
return Storage::url($this->path);
}
return (string) 'image/no_screen.png';
@@ -73,10 +70,7 @@ class Screen extends Model
public function getPathThumb(): string
{
if (!empty($this->path_thumb)) {
if (in_array(env('FILESYSTEM_DISK'), ['s3', 'minio'])) {
return Storage::url($this->path_thumb);
}
return (string) $this->path_thumb;
return Storage::url($this->path_thumb);
}
return (string) 'image/no_screen_thumb.png';

View File

@@ -61,10 +61,7 @@ class Service extends Model
public function getImage(): string
{
if (!empty($this->image)) {
if (in_array(env('FILESYSTEM_DISK'), ['s3', 'minio'])) {
return Storage::url($this->image);
}
return (string) $this->image;
return Storage::url($this->image);
}
return (string) 'images/no_brend.png';

View File

@@ -45,10 +45,7 @@ class Slider extends Model
public function getImage(): string
{
if (!empty($this->image)) {
if (in_array(env('FILESYSTEM_DISK'), ['s3', 'minio'])) {
return Storage::url($this->image);
}
return $this->image;
return Storage::url($this->image);
}
return '/images/nophoto.jpg';

View File

@@ -47,10 +47,7 @@ class SpecialOffer extends Model
public function getImage(): string
{
if (!empty($this->image)) {
if (in_array(env('FILESYSTEM_DISK'), ['s3', 'minio'])) {
return Storage::url($this->image);
}
return (string) $this->image;
return Storage::url($this->image);
}
return (string) 'images/nophoto.png';

View File

@@ -44,10 +44,7 @@ class UsefulInfo extends Model
public function getImage(): string
{
if (!empty($this->image)) {
if (in_array(env('FILESYSTEM_DISK'), ['s3', 'minio'])) {
return Storage::url($this->image);
}
return (string) $this->image;
return Storage::url($this->image);
}
return (string) 'images/no_brend.png';

View File

@@ -63,10 +63,7 @@ class UsefulInfoItem extends Model
public function getFile(): string
{
if (!empty($this->file_url)) {
if (in_array(env('FILESYSTEM_DISK'), ['s3', 'minio'])) {
return Storage::url($this->file_url);
}
return '/' . $this->file_url;
return Storage::url($this->file_url);
}
return '/images/no_product.jpg';