test
This commit is contained in:
@@ -54,17 +54,8 @@ class Controller extends ExController
|
||||
}
|
||||
|
||||
if ($request->hasFile('image')) {
|
||||
if (env('FILESYSTEM_DISK') == 's3') {
|
||||
// delete old image from s3
|
||||
Storage::disk('s3')->delete($brand->image);
|
||||
$path = $this->storeImageToS3($request->file('image'));
|
||||
} else {
|
||||
// detele old image
|
||||
if (is_file($brand->image)) {
|
||||
unlink($brand->image);
|
||||
}
|
||||
$path = $request->file('image')->store('uploads/brands');
|
||||
}
|
||||
Storage::delete($brand->image);
|
||||
$path = $this->storeImageToS3($request->file('image'));
|
||||
} else {
|
||||
$path = $brand->image;
|
||||
}
|
||||
@@ -87,12 +78,7 @@ class Controller extends ExController
|
||||
}
|
||||
|
||||
if ($request->hasFile('image')) {
|
||||
$file = $request->file('image');
|
||||
if (env('FILESYSTEM_DISK') == 's3') {
|
||||
$path = $this->storeImageToS3($file);
|
||||
} else {
|
||||
$path = $file->store('uploads/brands');
|
||||
}
|
||||
$path = $this->storeImageToS3($request->file('image'));
|
||||
}
|
||||
|
||||
$this->dispatchSync(StoreJob::fromRequest($request, $path));
|
||||
@@ -109,14 +95,7 @@ class Controller extends ExController
|
||||
{
|
||||
$this->authorize('delete', 'brands');
|
||||
|
||||
if (is_file($brand->image)) {
|
||||
unlink($brand->image);
|
||||
}
|
||||
|
||||
// delete image from s3
|
||||
if (env('FILESYSTEM_DISK') == 's3') {
|
||||
Storage::disk('s3')->delete($brand->image);
|
||||
}
|
||||
Storage::delete($brand->image);
|
||||
|
||||
Product::where('brand_id', $brand->id)->withTrashed()->update([
|
||||
'brand_id' => null
|
||||
|
||||
Reference in New Issue
Block a user