This commit is contained in:
2026-04-15 20:12:12 +05:00
parent 9e82ebc07e
commit d7ec26d246
5 changed files with 14 additions and 14 deletions

View File

@@ -62,7 +62,7 @@ class Brand extends Model
public function getImage(): string public function getImage(): string
{ {
if (!empty($this->image)) { if (!empty($this->image)) {
if (in_array(env('FILESYSTEM_DISK'), ['s3', 'minio'])) { if (in_array(config('filesystems.default'), ['s3', 'minio'])) {
return Storage::temporaryUrl( return Storage::temporaryUrl(
$this->image, $this->image,
Date::now()->addMinutes(5) Date::now()->addMinutes(5)

View File

@@ -147,17 +147,17 @@ class Category extends Model
public function getImage(): string public function getImage(): string
{ {
if (!in_array($this->image, ['null', null])) { if (!in_array($this->image, ['null', null])) {
if (in_array(env('FILESYSTEM_DISK'), ['s3', 'minio'])) { if (in_array(config('filesystems.default'), ['s3', 'minio'])) {
return Storage::temporaryUrl( return Storage::temporaryUrl(
$this->image, $this->image,
Date::now()->addMinutes(5) Date::now()->addMinutes(5)
); );
} }
return env('APP_URL') . '/' . $this->image; return config('app.url') . '/' . $this->image;
} }
return env('APP_URL') . '/images/nophoto.jpg'; return config('app.url') . '/images/nophoto.jpg';
} }
public function getParentId(): int public function getParentId(): int

View File

@@ -236,28 +236,28 @@ class Product extends Model
public function getPoster(): string public function getPoster(): string
{ {
if (!empty($this->poster)) { if (!empty($this->poster)) {
if (in_array(env('FILESYSTEM_DISK'), ['s3', 'minio'])) { if (in_array(config('filesystems.default'), ['s3', 'minio'])) {
return Storage::temporaryUrl( return Storage::temporaryUrl(
$this->poster, $this->poster,
Date::now()->addMinutes(5) Date::now()->addMinutes(5)
); );
} }
return env('APP_URL') . '/' . $this->poster; return config('app.url') . '/' . $this->poster;
} }
return env('APP_URL') . '/images/no_product.jpg'; return config('app.url') . '/images/no_product.jpg';
} }
public function getDataSheet() public function getDataSheet()
{ {
if (!empty($this->data_sheet) and ($this->data_sheet != null and $this->data_sheet != "null")) { if (!empty($this->data_sheet) and ($this->data_sheet != null and $this->data_sheet != "null")) {
if (in_array(env('FILESYSTEM_DISK'), ['s3', 'minio'])) { if (in_array(config('filesystems.default'), ['s3', 'minio'])) {
return Storage::temporaryUrl( return Storage::temporaryUrl(
$this->data_sheet, $this->data_sheet,
Date::now()->addMinutes(5) Date::now()->addMinutes(5)
); );
} }
return env('APP_URL') . '/' . $this->data_sheet; return config('app.url') . '/' . $this->data_sheet;
} }
return null; return null;
} }
@@ -265,16 +265,16 @@ class Product extends Model
public function getPosterThumb(): string public function getPosterThumb(): string
{ {
if (!empty($this->poster_thumb)) { if (!empty($this->poster_thumb)) {
if (in_array(env('FILESYSTEM_DISK'), ['s3', 'minio'])) { if (in_array(config('filesystems.default'), ['s3', 'minio'])) {
return Storage::temporaryUrl( return Storage::temporaryUrl(
$this->poster_thumb, $this->poster_thumb,
Date::now()->addMinutes(5) Date::now()->addMinutes(5)
); );
} }
return env('APP_URL') . '/' . $this->poster_thumb; return config('app.url') . '/' . $this->poster_thumb;
} }
return env('APP_URL') . '/images/no_product.jpg'; return config('app.url') . '/images/no_product.jpg';
} }
/** /**

View File

@@ -28,7 +28,7 @@
@section('content') @section('content')
<div id="app"> <div id="app">
<product-add :brands="{{ json_encode($brands) }}" :categories="{{ json_encode($categories) }}" <product-add :brands="{{ json_encode($brands) }}" :categories="{{ json_encode($categories) }}"
:colors="{{ json_encode($colors) }}" :back-url="{{ json_encode($_SERVER['HTTP_REFERER']) }}" :measurement="{{ json_encode($measurement) }}"></product-add> :colors="{{ json_encode($colors) }}" :back-url="{{ json_encode(url()->previous()) }}" :measurement="{{ json_encode($measurement) }}"></product-add>
</div> </div>
@endsection @endsection

View File

@@ -29,7 +29,7 @@
<div id="app"> <div id="app">
<product-edit :product="{{ json_encode($product) }}" :brands="{{ json_encode($brands) }}" <product-edit :product="{{ json_encode($product) }}" :brands="{{ json_encode($brands) }}"
:categories="{{ json_encode($categories) }}" :colors="{{ json_encode($colors) }}" :categories="{{ json_encode($categories) }}" :colors="{{ json_encode($colors) }}"
:back-url="{{ json_encode($_SERVER['HTTP_REFERER']) }}" :measurement="{{ json_encode($measurement) }}"></product-edit> :back-url="{{ json_encode(url()->previous()) }}" :measurement="{{ json_encode($measurement) }}"></product-edit>
</div> </div>
@endsection @endsection