storage url o'zgartirildi
This commit is contained in:
@@ -13,6 +13,7 @@ use App\Jobs\Dashboard\Category\Store as StoreJob;
|
||||
use App\Jobs\Dashboard\Category\Update as UpdateJob;
|
||||
use App\Models\Characteristic;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
|
||||
class Controller extends ExController
|
||||
@@ -168,29 +169,9 @@ class Controller extends ExController
|
||||
*/
|
||||
public function position_save(Request $request)
|
||||
{
|
||||
foreach ($request->categories as $category) {
|
||||
$cat = Category::find($category['id']);
|
||||
$cat->parent_id = $category['parent_id'] === 'null' ? null : $category['parent_id'];
|
||||
$cat->position = $category['position'];
|
||||
$cat->save();
|
||||
if (!empty($category['children'])) {
|
||||
foreach ($category['children'] as $c) {
|
||||
$cc = Category::find($c['id']);
|
||||
$cc->parent_id = $c['parent_id'] === 'null' ? null : $c['parent_id'];
|
||||
$cc->position = $c['position'];
|
||||
$cc->save();
|
||||
|
||||
if (!empty($c['children'])) {
|
||||
foreach ($c['children'] as $ccc) {
|
||||
$cccc = Category::find($ccc['id']);
|
||||
$cccc->parent_id = $ccc['parent_id'] === 'null' ? null : $ccc['parent_id'];
|
||||
$cccc->position = $ccc['position'];
|
||||
$cccc->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
DB::transaction(function () use ($request) {
|
||||
$this->saveCategoryPositions($request->input('categories', []), null);
|
||||
});
|
||||
|
||||
$this->info(trans('admin.messages.updated'));
|
||||
|
||||
@@ -199,6 +180,34 @@ class Controller extends ExController
|
||||
]);
|
||||
}
|
||||
|
||||
private function saveCategoryPositions(array $categories, $parentId = null): void
|
||||
{
|
||||
foreach (array_values($categories) as $index => $category) {
|
||||
$cat = Category::find($category['id'] ?? null);
|
||||
|
||||
if (!$cat) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$cat->parent_id = $this->normalizeParentId($parentId);
|
||||
$cat->position = $index + 1;
|
||||
$cat->save();
|
||||
|
||||
if (!empty($category['children']) && is_array($category['children'])) {
|
||||
$this->saveCategoryPositions($category['children'], $cat->id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function normalizeParentId($parentId)
|
||||
{
|
||||
if (in_array($parentId, [null, '', 'null', 'NULL', 0, '0'], true)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $parentId;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return array
|
||||
|
||||
@@ -45,23 +45,22 @@ class Controller extends ExController
|
||||
return view('dashboard.compilations.index', compact('compilations'));
|
||||
}
|
||||
|
||||
// public function store(StoreRequest $request)
|
||||
// {
|
||||
// if ($request->isMethod('get')) {
|
||||
// $this->authorize('create', 'compilations');
|
||||
//
|
||||
//// $this->authorize('content-manager');
|
||||
// $categories = $this->categories->where('parent_id', null)->get();
|
||||
// return view('dashboard.compilations.store', compact('categories'));
|
||||
// }
|
||||
//
|
||||
// $this->dispatchSync(new StoreJob($request));
|
||||
//
|
||||
// $this->success(trans('admin.messages.created'));
|
||||
// return response()->json([
|
||||
// 'status' => true
|
||||
// ]);
|
||||
// }
|
||||
public function store(StoreRequest $request)
|
||||
{
|
||||
if ($request->isMethod('get')) {
|
||||
$this->authorize('create', 'compilations');
|
||||
|
||||
$categories = $this->categories->whereNull('parent_id')->orderBy('position')->get();
|
||||
return view('dashboard.compilations.store', compact('categories'));
|
||||
}
|
||||
|
||||
$this->dispatchSync(new StoreJob($request));
|
||||
|
||||
$this->success(trans('admin.messages.created'));
|
||||
return response()->json([
|
||||
'status' => true
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Compilation $compilation
|
||||
@@ -74,17 +73,20 @@ class Controller extends ExController
|
||||
if ($request->isMethod('get')) {
|
||||
// $this->authorize('content-manager');
|
||||
|
||||
$compilation->loadMissing(['products:id,name,poster']);
|
||||
|
||||
$this->authorize('update', 'compilations');
|
||||
|
||||
foreach ($compilation->products as $product) {
|
||||
$product->poster = '/'. $product->poster;
|
||||
$products = $compilation->dashboardProducts()
|
||||
->select('products.id', 'products.name', 'products.poster')
|
||||
->get();
|
||||
|
||||
foreach ($products as $product) {
|
||||
$product->poster = $product->getPoster();
|
||||
$product->name = $product->name['ru'];
|
||||
}
|
||||
|
||||
$compilation->setRelation('products', $products);
|
||||
|
||||
$categories = $this->categories->where('parent_id', false)->get();
|
||||
$categories = $this->categories->whereNull('parent_id')->orderBy('position')->get();
|
||||
|
||||
|
||||
return view('dashboard.compilations.update', compact('compilation', 'categories'));
|
||||
@@ -104,12 +106,34 @@ class Controller extends ExController
|
||||
*/
|
||||
public function search(Request $request)
|
||||
{
|
||||
$query = $request->name;
|
||||
$query = trim((string) $request->name);
|
||||
$categoryId = (int) $request->get('category_id');
|
||||
|
||||
$product = $this->products->published()->where('name->ru', 'like', $query . '%')->get()->map(function ($product) {
|
||||
$product = $this->products
|
||||
->newQuery()
|
||||
->whereNull('child_id')
|
||||
->when($categoryId > 0, function ($builder) use ($categoryId) {
|
||||
$categoryIds = $this->categoryIdsWithChildren($categoryId);
|
||||
|
||||
$builder->whereHas('categories', function ($category) use ($categoryIds) {
|
||||
$category->whereIn('categories.id', $categoryIds);
|
||||
});
|
||||
})
|
||||
->when($query !== '', function ($builder) use ($query) {
|
||||
$builder->where(function ($search) use ($query) {
|
||||
$search
|
||||
->where('name->ru', 'like', '%' . $query . '%')
|
||||
->orWhere('name->uz', 'like', '%' . $query . '%')
|
||||
->orWhere('article_number', 'like', '%' . $query . '%');
|
||||
});
|
||||
})
|
||||
->orderBy('id', 'desc')
|
||||
->limit(30)
|
||||
->get()
|
||||
->map(function ($product) {
|
||||
return [
|
||||
'id' => $product->id,
|
||||
'poster' => '/' . $product->poster,
|
||||
'poster' => $product->getPoster(),
|
||||
'name' => $product->name['ru']
|
||||
];
|
||||
});
|
||||
@@ -120,6 +144,27 @@ class Controller extends ExController
|
||||
]);
|
||||
}
|
||||
|
||||
private function categoryIdsWithChildren(int $categoryId): array
|
||||
{
|
||||
$category = Category::with('children.children')->find($categoryId);
|
||||
|
||||
if (!$category) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$ids = [$category->id];
|
||||
|
||||
foreach ($category->children as $child) {
|
||||
$ids[] = $child->id;
|
||||
|
||||
foreach ($child->children as $grandChild) {
|
||||
$ids[] = $grandChild->id;
|
||||
}
|
||||
}
|
||||
|
||||
return $ids;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param Compilation $compilation
|
||||
|
||||
@@ -283,11 +283,7 @@ class Controller extends ExController
|
||||
foreach ($product->childrens as $children) {
|
||||
foreach ($children->screens as $screen) {
|
||||
$screen->sizeText = $screen->size / 1024 . 'Kb';
|
||||
if (env('FILESYSTEM_DISK') == 's3') {
|
||||
$screen->url = Storage::url($screen->path);
|
||||
} else {
|
||||
$screen->url = '/' . $screen->path;
|
||||
}
|
||||
$screen->url = Storage::url($screen->path);
|
||||
$screen->type = "image/jpeg";
|
||||
}
|
||||
}
|
||||
@@ -318,15 +314,15 @@ class Controller extends ExController
|
||||
try {
|
||||
$this->dispatchSync(new UpdateJob($product, $request));
|
||||
$this->dispatchSync(new ChildUpdateJob($request, $product));
|
||||
$this->charSync($product, $request->characteristics);
|
||||
$this->dispatchSync(new DeletesJob($request));
|
||||
} catch (Exception $e) {
|
||||
return Response::json([
|
||||
"messages" => $e->getMessage()
|
||||
]);
|
||||
'status' => false,
|
||||
'messages' => $e->getMessage()
|
||||
], 500);
|
||||
}
|
||||
|
||||
$this->charSync($product, $request->characteristics);
|
||||
|
||||
$this->dispatchSync(new DeletesJob($request));
|
||||
$this->info(trans('admin.messages.updated'));
|
||||
|
||||
return response()->json([
|
||||
@@ -394,8 +390,12 @@ class Controller extends ExController
|
||||
$article_number = empty($request->get('article_number')) ? null : $request->get('article_number');
|
||||
|
||||
if ($category) {
|
||||
$categoryFind = Category::find($category);
|
||||
list($categoryFind, $category_id) = $this->categoryQuery->getCategoriesAndCategoryMainId($categoryFind);
|
||||
$categoryFind = Category::withTrashed()->find($category);
|
||||
if ($categoryFind) {
|
||||
list($categoryFind, $category_id) = $this->categoryQuery->getCategoriesAndCategoryMainId($categoryFind);
|
||||
} else {
|
||||
$category_id = [];
|
||||
}
|
||||
} else {
|
||||
$category_id = [];
|
||||
}
|
||||
|
||||
@@ -40,14 +40,14 @@ class Update extends FormRequest
|
||||
return Str::slug($this->get('name')['uz']);
|
||||
}
|
||||
|
||||
public function getImage(Category $category): string
|
||||
public function getImage(Category $category): ?string
|
||||
{
|
||||
if ($this->hasFile('image')) {
|
||||
Storage::delete($category->image);
|
||||
return (string) $this->file('image')->store('uploads/categories');
|
||||
} else {
|
||||
return 'null';
|
||||
}
|
||||
|
||||
return $category->image;
|
||||
}
|
||||
|
||||
public function getFilterPower()
|
||||
|
||||
@@ -22,7 +22,8 @@ class Store extends FormRequest
|
||||
return [
|
||||
'title' => 'array',
|
||||
'title.*' => 'required',
|
||||
'published' => 'required',
|
||||
'published' => 'nullable',
|
||||
'products' => 'nullable|array',
|
||||
//'category_id' => 'required'
|
||||
];
|
||||
}
|
||||
@@ -40,7 +41,7 @@ class Store extends FormRequest
|
||||
*/
|
||||
public function getPublished(): bool
|
||||
{
|
||||
return $this->get('published');
|
||||
return filter_var($this->get('published', false), FILTER_VALIDATE_BOOLEAN);
|
||||
}
|
||||
|
||||
|
||||
@@ -49,8 +50,8 @@ class Store extends FormRequest
|
||||
*/
|
||||
public function getCategory()
|
||||
{
|
||||
if ($this->get('category_id')) {
|
||||
$this->get('category_id');
|
||||
if ($this->get('category_id') && $this->get('category_id') != 0) {
|
||||
return $this->get('category_id');
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
@@ -22,7 +22,8 @@ class Update extends FormRequest
|
||||
return [
|
||||
'title' => 'array',
|
||||
'title.*' => 'required',
|
||||
'published' => 'required',
|
||||
'published' => 'nullable',
|
||||
'products' => 'nullable|array',
|
||||
//'category_id' => 'required',
|
||||
];
|
||||
}
|
||||
@@ -40,14 +41,14 @@ class Update extends FormRequest
|
||||
*/
|
||||
public function getPublished(): bool
|
||||
{
|
||||
return $this->get('published');
|
||||
return filter_var($this->get('published', false), FILTER_VALIDATE_BOOLEAN);
|
||||
}
|
||||
|
||||
|
||||
public function getCategory()
|
||||
{
|
||||
if ($this->get('category_id')) {
|
||||
$this->get('category_id');
|
||||
if ($this->get('category_id') && $this->get('category_id') != 0) {
|
||||
return $this->get('category_id');
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
@@ -35,8 +35,8 @@ class Update
|
||||
$category->name = $request->getName();
|
||||
$category->slug = $request->getSlug();
|
||||
$category->position = $request->getPosition();
|
||||
$category->image = $request->getImage($category);
|
||||
// $category->parent_id = $request->getParentId();
|
||||
$category->image = $this->image;
|
||||
$category->parent_id = $request->getParentId();
|
||||
// $category->popular = $request->getPopular();
|
||||
$category->published = $request->getPublished();
|
||||
$category->is_filter_power = $request->getFilterPower();
|
||||
@@ -45,8 +45,6 @@ class Update
|
||||
$category->keywords = $request->keywords;
|
||||
$category->title_seo = $request->title_seo;
|
||||
|
||||
$category->image = $this->image;
|
||||
|
||||
$category->save();
|
||||
|
||||
if (isset($request->brands)) {
|
||||
|
||||
@@ -36,8 +36,10 @@ class Store
|
||||
|
||||
$map = array_map(function ($product) {
|
||||
return $product['id'];
|
||||
}, $this->request->products);
|
||||
}, $this->request->products ?? []);
|
||||
|
||||
$compilation->products()->attach($map);
|
||||
if (!empty($map)) {
|
||||
$compilation->products()->attach($map);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,20 +35,12 @@ class Update
|
||||
'category_id' => $this->request->getCategory()
|
||||
]);
|
||||
|
||||
$detach = Compilation::find($this->compilation->id);
|
||||
$detach->loadMissing(['products:id']);
|
||||
|
||||
$compilation = Compilation::find($this->compilation->id);
|
||||
|
||||
$map = array_map(function ($product) {
|
||||
return $product['id'];
|
||||
}, $this->request->products);
|
||||
}, $this->request->products ?? []);
|
||||
|
||||
$detach = array_map(function ($product) {
|
||||
return $product['id'];
|
||||
}, $detach->products->toArray());
|
||||
|
||||
$compilation->products()->detach($detach);
|
||||
$compilation->products()->attach($map);
|
||||
$compilation->products()->sync($map);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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