test
This commit is contained in:
@@ -71,7 +71,7 @@ class ContractTemplateController extends ExController
|
|||||||
if ($request->hasFile('file')) {
|
if ($request->hasFile('file')) {
|
||||||
// delete old file
|
// delete old file
|
||||||
if ($template->path) {
|
if ($template->path) {
|
||||||
Storage::disk('public')->delete($template->path);
|
Storage::delete($template->path);
|
||||||
}
|
}
|
||||||
|
|
||||||
// store file to storage
|
// store file to storage
|
||||||
@@ -95,7 +95,7 @@ class ContractTemplateController extends ExController
|
|||||||
$template = ContractTemplate::findOrFail($templateId);
|
$template = ContractTemplate::findOrFail($templateId);
|
||||||
|
|
||||||
if ($template->path) {
|
if ($template->path) {
|
||||||
Storage::disk('public')->delete($template->path);
|
Storage::delete($template->path);
|
||||||
}
|
}
|
||||||
|
|
||||||
$template->delete();
|
$template->delete();
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ namespace App\Http\Controllers\Dashboard\File;
|
|||||||
use App\Models\File;
|
use App\Models\File;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use App\Http\Controllers\Controller as ExController;
|
use App\Http\Controllers\Controller as ExController;
|
||||||
|
use Illuminate\Support\Facades\Storage;
|
||||||
|
|
||||||
use App\Http\Requests\Dashboard\File\Store as StoreRequest;
|
use App\Http\Requests\Dashboard\File\Store as StoreRequest;
|
||||||
use App\Jobs\Dashboard\File\Store as StoreJob;
|
use App\Jobs\Dashboard\File\Store as StoreJob;
|
||||||
@@ -44,7 +45,7 @@ class Controller extends ExController
|
|||||||
$this->authorize('create', 'files');
|
$this->authorize('create', 'files');
|
||||||
|
|
||||||
$path = $request->file('file')->store('uploads/files');
|
$path = $request->file('file')->store('uploads/files');
|
||||||
$size = filesize($path);
|
$size = Storage::size($path);
|
||||||
|
|
||||||
$this->dispatchSync(StoreJob::fromRequest($request, $path, $size));
|
$this->dispatchSync(StoreJob::fromRequest($request, $path, $size));
|
||||||
|
|
||||||
@@ -61,9 +62,7 @@ class Controller extends ExController
|
|||||||
{
|
{
|
||||||
$this->authorize('delete', 'files');
|
$this->authorize('delete', 'files');
|
||||||
|
|
||||||
if (is_file($file->path)) {
|
Storage::delete($file->path);
|
||||||
unlink($file->path);
|
|
||||||
}
|
|
||||||
|
|
||||||
$file->delete();
|
$file->delete();
|
||||||
$this->info(trans('admin.messages.deleted'));
|
$this->info(trans('admin.messages.deleted'));
|
||||||
|
|||||||
@@ -84,25 +84,29 @@ class Controller extends ExController
|
|||||||
$this->authorize('create', 'products');
|
$this->authorize('create', 'products');
|
||||||
$categories = $this->categories->select('id', 'name->ru as category')
|
$categories = $this->categories->select('id', 'name->ru as category')
|
||||||
->where('parent_id', null)
|
->where('parent_id', null)
|
||||||
->with(['parents' => function ($parent) {
|
->with([
|
||||||
return $parent->select('id', 'name->ru as category', 'parent_id')->with(['parents' => function ($parent) {
|
'parents' => function ($parent) {
|
||||||
return $parent->select('id', 'name->ru as category', 'parent_id');
|
return $parent->select('id', 'name->ru as category', 'parent_id')->with([
|
||||||
}]);
|
'parents' => function ($parent) {
|
||||||
}])->get();
|
return $parent->select('id', 'name->ru as category', 'parent_id');
|
||||||
|
}
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
])->get();
|
||||||
$brands = $this->brands->get();
|
$brands = $this->brands->get();
|
||||||
$colors = $this->colors->get();
|
$colors = $this->colors->get();
|
||||||
$measurement = Measurement::query()->get();
|
$measurement = Measurement::query()->get();
|
||||||
|
|
||||||
return view('dashboard.products.store', compact('categories', 'brands', 'colors', 'measurement'));
|
return view('dashboard.products.store', compact('categories', 'brands', 'colors', 'measurement'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$product = $this->dispatchSync(StoreJob::fromRequest($request));
|
$product = $this->dispatchSync(StoreJob::fromRequest($request));
|
||||||
|
|
||||||
$product->categories()->attach([$request->getCategoryID()]);
|
$product->categories()->attach([$request->getCategoryID()]);
|
||||||
|
|
||||||
$this->charSync($product, $request->characteristics);
|
$this->charSync($product, $request->characteristics);
|
||||||
$this->dispatchSync(new ChildJob($request, $product));
|
$this->dispatchSync(new ChildJob($request, $product));
|
||||||
|
|
||||||
$this->success(trans('admin.messages.created'));
|
$this->success(trans('admin.messages.created'));
|
||||||
|
|
||||||
return response()->json([
|
return response()->json([
|
||||||
@@ -254,15 +258,23 @@ class Controller extends ExController
|
|||||||
]);
|
]);
|
||||||
},
|
},
|
||||||
'categories' => function ($categories) {
|
'categories' => function ($categories) {
|
||||||
return $categories->select('id', 'name->ru as category', 'parent_id')->with(['parent' => function ($parent) {
|
return $categories->select('id', 'name->ru as category', 'parent_id')->with([
|
||||||
return $parent->select('id', 'name->ru as category', 'parent_id')->with(['parents', 'parent' => function ($parent) {
|
'parent' => function ($parent) {
|
||||||
return $parent->select('id', 'name->ru as category', 'parent_id')->with(['parents' => function ($parent) {
|
return $parent->select('id', 'name->ru as category', 'parent_id')->with([
|
||||||
return $parent->select('id', 'name->ru as category', 'parent_id');
|
'parents',
|
||||||
}]);
|
'parent' => function ($parent) {
|
||||||
}, 'parents' => function ($parent) {
|
return $parent->select('id', 'name->ru as category', 'parent_id')->with([
|
||||||
return $parent->select('id', 'name->ru as category', 'parent_id');
|
'parents' => function ($parent) {
|
||||||
}]);
|
return $parent->select('id', 'name->ru as category', 'parent_id');
|
||||||
}]);
|
}
|
||||||
|
]);
|
||||||
|
},
|
||||||
|
'parents' => function ($parent) {
|
||||||
|
return $parent->select('id', 'name->ru as category', 'parent_id');
|
||||||
|
}
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
]);
|
||||||
},
|
},
|
||||||
|
|
||||||
'characteristics'
|
'characteristics'
|
||||||
@@ -271,19 +283,30 @@ class Controller extends ExController
|
|||||||
foreach ($product->childrens as $children) {
|
foreach ($product->childrens as $children) {
|
||||||
foreach ($children->screens as $screen) {
|
foreach ($children->screens as $screen) {
|
||||||
$screen->sizeText = $screen->size / 1024 . 'Kb';
|
$screen->sizeText = $screen->size / 1024 . 'Kb';
|
||||||
$screen->url = $screen->getPath();
|
if (env('FILESYSTEM_DISK') == 's3') {
|
||||||
|
$screen->url = Storage::temporaryUrl(
|
||||||
|
$screen->path,
|
||||||
|
Date::now()->addMinutes(5)
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
$screen->url = '/' . $screen->path;
|
||||||
|
}
|
||||||
$screen->type = "image/jpeg";
|
$screen->type = "image/jpeg";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$categories = $this->categories->select('id', 'name->ru as category')
|
$categories = $this->categories->select('id', 'name->ru as category')
|
||||||
->where('parent_id', null)
|
->where('parent_id', null)
|
||||||
->with(['parents' => function ($parent) {
|
->with([
|
||||||
return $parent->select('id', 'name->ru as category', 'parent_id')->with(['parents' => function ($parent) {
|
'parents' => function ($parent) {
|
||||||
return $parent->select('id', 'name->ru as category', 'parent_id');
|
return $parent->select('id', 'name->ru as category', 'parent_id')->with([
|
||||||
}]);
|
'parents' => function ($parent) {
|
||||||
}])->get();
|
return $parent->select('id', 'name->ru as category', 'parent_id');
|
||||||
|
}
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
])->get();
|
||||||
|
|
||||||
$brands = $this->brands->get();
|
$brands = $this->brands->get();
|
||||||
$measurement = Measurement::query()->get();
|
$measurement = Measurement::query()->get();
|
||||||
@@ -294,11 +317,11 @@ class Controller extends ExController
|
|||||||
|
|
||||||
return view('dashboard.products.update', compact('categories', 'brands', 'colors', 'product', 'measurement'));
|
return view('dashboard.products.update', compact('categories', 'brands', 'colors', 'product', 'measurement'));
|
||||||
}
|
}
|
||||||
|
|
||||||
try{
|
try {
|
||||||
$this->dispatchSync(new UpdateJob($product, $request));
|
$this->dispatchSync(new UpdateJob($product, $request));
|
||||||
$this->dispatchSync(new ChildUpdateJob($request, $product));
|
$this->dispatchSync(new ChildUpdateJob($request, $product));
|
||||||
}catch(Exception $e){
|
} catch (Exception $e) {
|
||||||
return Response::json([
|
return Response::json([
|
||||||
"messages" => $e->getMessage()
|
"messages" => $e->getMessage()
|
||||||
]);
|
]);
|
||||||
@@ -410,13 +433,8 @@ class Controller extends ExController
|
|||||||
*/
|
*/
|
||||||
public function delete_screen(Screen $screen)
|
public function delete_screen(Screen $screen)
|
||||||
{
|
{
|
||||||
if (is_file($screen->path)) {
|
Storage::delete($screen->path);
|
||||||
unlink($screen->path);
|
Storage::delete($screen->path_thumb);
|
||||||
}
|
|
||||||
|
|
||||||
if (is_file($screen->path_thumb)) {
|
|
||||||
unlink($screen->path_thumb);
|
|
||||||
}
|
|
||||||
|
|
||||||
$screen->delete();
|
$screen->delete();
|
||||||
|
|
||||||
@@ -434,9 +452,9 @@ class Controller extends ExController
|
|||||||
'file' => 'required|mimes:xlsx,xls'
|
'file' => 'required|mimes:xlsx,xls'
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$file = $request->file('file')->store('uploads/imports');
|
$file = $request->file('file')->store('uploads/imports', 'local');
|
||||||
|
|
||||||
$excel = Excel::toArray(new MobileImport, $file);
|
$excel = Excel::toArray(new MobileImport, storage_path('app/' . $file));
|
||||||
|
|
||||||
$excel = collect($excel)->flatten(1)->map(function ($product) {
|
$excel = collect($excel)->flatten(1)->map(function ($product) {
|
||||||
if ($product[0] != null) {
|
if ($product[0] != null) {
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ namespace App\Http\Controllers\Dashboard\Slider;
|
|||||||
use App\Models\Slider;
|
use App\Models\Slider;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use App\Http\Controllers\Controller as ExController;
|
use App\Http\Controllers\Controller as ExController;
|
||||||
|
use Illuminate\Support\Facades\Storage;
|
||||||
|
|
||||||
use App\Http\Requests\Dashboard\Slider\Update as UpdateRequest;
|
use App\Http\Requests\Dashboard\Slider\Update as UpdateRequest;
|
||||||
use App\Http\Requests\Dashboard\Slider\Store as StoreRequest;
|
use App\Http\Requests\Dashboard\Slider\Store as StoreRequest;
|
||||||
@@ -92,9 +93,7 @@ class Controller extends ExController
|
|||||||
public function delete(Slider $slider)
|
public function delete(Slider $slider)
|
||||||
{
|
{
|
||||||
$this->authorize('delete', 'sliders');
|
$this->authorize('delete', 'sliders');
|
||||||
if (is_file($slider->image)) {
|
Storage::delete($slider->image);
|
||||||
unlink($slider->image);
|
|
||||||
}
|
|
||||||
|
|
||||||
$slider->delete();
|
$slider->delete();
|
||||||
$this->info(trans('admin.messages.deleted'));
|
$this->info(trans('admin.messages.deleted'));
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ namespace App\Http\Controllers\Dashboard\SpecialOffer;
|
|||||||
|
|
||||||
use App\Models\SpecialOffer;
|
use App\Models\SpecialOffer;
|
||||||
use App\Http\Controllers\Controller as ExController;
|
use App\Http\Controllers\Controller as ExController;
|
||||||
|
use Illuminate\Support\Facades\Storage;
|
||||||
|
|
||||||
use App\Http\Requests\Dashboard\SpecialOffer\Update as UpdateRequest;
|
use App\Http\Requests\Dashboard\SpecialOffer\Update as UpdateRequest;
|
||||||
use App\Http\Requests\Dashboard\SpecialOffer\Store as StoreRequest;
|
use App\Http\Requests\Dashboard\SpecialOffer\Store as StoreRequest;
|
||||||
@@ -87,9 +88,7 @@ class Controller extends ExController
|
|||||||
{
|
{
|
||||||
$this->authorize('delete', 'special-offers');
|
$this->authorize('delete', 'special-offers');
|
||||||
|
|
||||||
if (is_file($specialOffer->image)) {
|
Storage::delete($specialOffer->image);
|
||||||
unlink($specialOffer->image);
|
|
||||||
}
|
|
||||||
|
|
||||||
$specialOffer->delete();
|
$specialOffer->delete();
|
||||||
$this->info(trans('admin.messages.deleted'));
|
$this->info(trans('admin.messages.deleted'));
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ use App\Http\Requests\Dashboard\UsefulInfoRequest\Store as StoreRequest;
|
|||||||
|
|
||||||
use App\Jobs\Dashboard\UsefulInfoJob\Store as StoreJob;
|
use App\Jobs\Dashboard\UsefulInfoJob\Store as StoreJob;
|
||||||
use App\Jobs\Dashboard\UsefulInfoJob\Update as UpdateJob;
|
use App\Jobs\Dashboard\UsefulInfoJob\Update as UpdateJob;
|
||||||
use Illuminate\Support\Facades\File;
|
|
||||||
use Illuminate\Support\Facades\Storage;
|
use Illuminate\Support\Facades\Storage;
|
||||||
|
|
||||||
class Controller extends ExController
|
class Controller extends ExController
|
||||||
@@ -78,10 +77,8 @@ class Controller extends ExController
|
|||||||
|
|
||||||
// delete items files
|
// delete items files
|
||||||
foreach ($usefulinfo->items as $item) {
|
foreach ($usefulinfo->items as $item) {
|
||||||
$filePath = public_path($item->file_url);
|
if ($item->file_url) {
|
||||||
|
Storage::delete($item->file_url);
|
||||||
if (File::exists($filePath)) {
|
|
||||||
File::delete($filePath);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$item->delete();
|
$item->delete();
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ use App\Jobs\Dashboard\UsefulInfoItemJob\Store as StoreJob;
|
|||||||
use App\Jobs\Dashboard\UsefulInfoItemJob\Update as UpdateJob;
|
use App\Jobs\Dashboard\UsefulInfoItemJob\Update as UpdateJob;
|
||||||
use App\Models\UsefulInfo;
|
use App\Models\UsefulInfo;
|
||||||
use App\Models\UsefulInfoItem;
|
use App\Models\UsefulInfoItem;
|
||||||
use Illuminate\Support\Facades\File;
|
use Illuminate\Support\Facades\Storage;
|
||||||
|
|
||||||
class Controller extends ExController
|
class Controller extends ExController
|
||||||
{
|
{
|
||||||
@@ -54,11 +54,7 @@ class Controller extends ExController
|
|||||||
{
|
{
|
||||||
$file_path = null;
|
$file_path = null;
|
||||||
if ($request->hasFile('file')) {
|
if ($request->hasFile('file')) {
|
||||||
$filePath = public_path($usefulinfoitem->file_url);
|
Storage::delete($usefulinfoitem->file_url);
|
||||||
|
|
||||||
if (File::exists($filePath)) {
|
|
||||||
File::delete($filePath);
|
|
||||||
}
|
|
||||||
|
|
||||||
$file_path = $request->file('file')->store('uploads/usefulinfoitems');
|
$file_path = $request->file('file')->store('uploads/usefulinfoitems');
|
||||||
} else {
|
} else {
|
||||||
@@ -75,11 +71,7 @@ class Controller extends ExController
|
|||||||
{
|
{
|
||||||
$this->authorize('delete', 'usefulinfoitems');
|
$this->authorize('delete', 'usefulinfoitems');
|
||||||
|
|
||||||
$filePath = public_path($usefulinfoitem->file_url);
|
Storage::delete($usefulinfoitem->file_url);
|
||||||
|
|
||||||
if (File::exists($filePath)) {
|
|
||||||
File::delete($filePath);
|
|
||||||
}
|
|
||||||
|
|
||||||
$usefulinfoitem->delete();
|
$usefulinfoitem->delete();
|
||||||
|
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ class Store extends FormRequest
|
|||||||
{
|
{
|
||||||
$image = $this->file('poster');
|
$image = $this->file('poster');
|
||||||
$tempPath = $image->store('temp', 'public');
|
$tempPath = $image->store('temp', 'public');
|
||||||
|
|
||||||
$resizer = new ImageResize();
|
$resizer = new ImageResize();
|
||||||
return $resizer->resize($tempPath, 322, 'posters', true);
|
return $resizer->resize($tempPath, 322, 'posters', true);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ use Carbon\Carbon;
|
|||||||
use Illuminate\Support\Arr;
|
use Illuminate\Support\Arr;
|
||||||
use App\Models\Screen as Screens;
|
use App\Models\Screen as Screens;
|
||||||
use App\Api\ImageResize;
|
use App\Api\ImageResize;
|
||||||
|
use Illuminate\Support\Facades\Storage;
|
||||||
|
|
||||||
|
|
||||||
class Screen
|
class Screen
|
||||||
|
|||||||
@@ -63,8 +63,12 @@ class Brand extends Model
|
|||||||
{
|
{
|
||||||
if (!empty($this->image)) {
|
if (!empty($this->image)) {
|
||||||
if (in_array(config('filesystems.default'), ['s3', 'minio'])) {
|
if (in_array(config('filesystems.default'), ['s3', 'minio'])) {
|
||||||
return rtrim(config('filesystems.disks.s3.url'), '/') . '/' . ltrim($this->image, '/');
|
return Storage::temporaryUrl(
|
||||||
|
$this->image,
|
||||||
|
Date::now()->addMinutes(5)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
;
|
||||||
|
|
||||||
return (string) '/' . $this->image;
|
return (string) '/' . $this->image;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -148,7 +148,10 @@ class Category extends Model
|
|||||||
{
|
{
|
||||||
if (!in_array($this->image, ['null', null])) {
|
if (!in_array($this->image, ['null', null])) {
|
||||||
if (in_array(config('filesystems.default'), ['s3', 'minio'])) {
|
if (in_array(config('filesystems.default'), ['s3', 'minio'])) {
|
||||||
return rtrim(config('filesystems.disks.s3.url'), '/') . '/' . ltrim($this->image, '/');
|
return Storage::temporaryUrl(
|
||||||
|
$this->image,
|
||||||
|
Date::now()->addMinutes(5)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return config('app.url') . '/' . $this->image;
|
return config('app.url') . '/' . $this->image;
|
||||||
|
|||||||
@@ -237,7 +237,10 @@ class Product extends Model
|
|||||||
{
|
{
|
||||||
if (!empty($this->poster)) {
|
if (!empty($this->poster)) {
|
||||||
if (in_array(config('filesystems.default'), ['s3', 'minio'])) {
|
if (in_array(config('filesystems.default'), ['s3', 'minio'])) {
|
||||||
return rtrim(config('filesystems.disks.s3.url'), '/') . '/' . ltrim($this->poster, '/');
|
return Storage::temporaryUrl(
|
||||||
|
$this->poster,
|
||||||
|
Date::now()->addMinutes(5)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
return config('app.url') . '/' . $this->poster;
|
return config('app.url') . '/' . $this->poster;
|
||||||
}
|
}
|
||||||
@@ -249,7 +252,10 @@ class Product extends Model
|
|||||||
{
|
{
|
||||||
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(config('filesystems.default'), ['s3', 'minio'])) {
|
if (in_array(config('filesystems.default'), ['s3', 'minio'])) {
|
||||||
return rtrim(config('filesystems.disks.s3.url'), '/') . '/' . ltrim($this->data_sheet, '/');
|
return Storage::temporaryUrl(
|
||||||
|
$this->data_sheet,
|
||||||
|
Date::now()->addMinutes(5)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
return config('app.url') . '/' . $this->data_sheet;
|
return config('app.url') . '/' . $this->data_sheet;
|
||||||
}
|
}
|
||||||
@@ -260,7 +266,10 @@ class Product extends Model
|
|||||||
{
|
{
|
||||||
if (!empty($this->poster_thumb)) {
|
if (!empty($this->poster_thumb)) {
|
||||||
if (in_array(config('filesystems.default'), ['s3', 'minio'])) {
|
if (in_array(config('filesystems.default'), ['s3', 'minio'])) {
|
||||||
return rtrim(config('filesystems.disks.s3.url'), '/') . '/' . ltrim($this->poster_thumb, '/');
|
return Storage::temporaryUrl(
|
||||||
|
$this->poster_thumb,
|
||||||
|
Date::now()->addMinutes(5)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
return config('app.url') . '/' . $this->poster_thumb;
|
return config('app.url') . '/' . $this->poster_thumb;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,12 @@ class Screen extends Model
|
|||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'name', 'path', 'path_thumb', 'size', 'product_id', 'type'
|
'name',
|
||||||
|
'path',
|
||||||
|
'path_thumb',
|
||||||
|
'size',
|
||||||
|
'product_id',
|
||||||
|
'type'
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -53,10 +58,13 @@ class Screen extends Model
|
|||||||
public function getPath(): string
|
public function getPath(): string
|
||||||
{
|
{
|
||||||
if (!empty($this->path)) {
|
if (!empty($this->path)) {
|
||||||
if (in_array(config('filesystems.default'), ['s3', 'minio'])) {
|
if (in_array(env('FILESYSTEM_DISK'), ['s3', 'minio'])) {
|
||||||
return rtrim(config('filesystems.disks.s3.url'), '/') . '/' . ltrim($this->path, '/');
|
return Storage::temporaryUrl(
|
||||||
|
$this->path,
|
||||||
|
Date::now()->addMinutes(5)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
return config('app.url') . '/' . $this->path;
|
return (string) $this->path;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (string) 'image/no_screen.png';
|
return (string) 'image/no_screen.png';
|
||||||
@@ -68,10 +76,13 @@ class Screen extends Model
|
|||||||
public function getPathThumb(): string
|
public function getPathThumb(): string
|
||||||
{
|
{
|
||||||
if (!empty($this->path_thumb)) {
|
if (!empty($this->path_thumb)) {
|
||||||
if (in_array(config('filesystems.default'), ['s3', 'minio'])) {
|
if (in_array(env('FILESYSTEM_DISK'), ['s3', 'minio'])) {
|
||||||
return rtrim(config('filesystems.disks.s3.url'), '/') . '/' . ltrim($this->path_thumb, '/');
|
return Storage::temporaryUrl(
|
||||||
|
$this->path_thumb,
|
||||||
|
Date::now()->addMinutes(5)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
return config('app.url') . '/' . $this->path_thumb;
|
return (string) $this->path_thumb;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (string) 'image/no_screen_thumb.png';
|
return (string) 'image/no_screen_thumb.png';
|
||||||
|
|||||||
Reference in New Issue
Block a user