category qosishsh to'g'irlandi

This commit is contained in:
2026-04-29 15:06:12 +05:00
parent 4297363cea
commit ba137edd1d
2 changed files with 20 additions and 0 deletions

View File

@@ -236,6 +236,10 @@ class Product extends Model
public function getPoster(): string
{
if (!empty($this->poster)) {
if (str_starts_with($this->poster, 'uploads/') && file_exists(public_path($this->poster))) {
return asset($this->poster);
}
return Storage::url($this->poster);
}
@@ -245,6 +249,10 @@ class Product extends Model
public function getDataSheet()
{
if (!empty($this->data_sheet) and ($this->data_sheet != null and $this->data_sheet != "null")) {
if (str_starts_with($this->data_sheet, 'uploads/') && file_exists(public_path($this->data_sheet))) {
return asset($this->data_sheet);
}
return Storage::url($this->data_sheet);
}
return null;
@@ -253,6 +261,10 @@ class Product extends Model
public function getPosterThumb(): string
{
if (!empty($this->poster_thumb)) {
if (str_starts_with($this->poster_thumb, 'uploads/') && file_exists(public_path($this->poster_thumb))) {
return asset($this->poster_thumb);
}
return Storage::url($this->poster_thumb);
}

View File

@@ -58,6 +58,10 @@ class Screen extends Model
public function getPath(): string
{
if (!empty($this->path)) {
if (str_starts_with($this->path, 'uploads/') && file_exists(public_path($this->path))) {
return asset($this->path);
}
return Storage::url($this->path);
}
@@ -70,6 +74,10 @@ class Screen extends Model
public function getPathThumb(): string
{
if (!empty($this->path_thumb)) {
if (str_starts_with($this->path_thumb, 'uploads/') && file_exists(public_path($this->path_thumb))) {
return asset($this->path_thumb);
}
return Storage::url($this->path_thumb);
}