storage url o'zgartirildi
This commit is contained in:
@@ -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';
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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');
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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';
|
||||
|
||||
Reference in New Issue
Block a user