This commit is contained in:
2026-04-16 11:25:40 +05:00
parent 2ba5677c45
commit 3aa4601229
13 changed files with 80 additions and 234 deletions

View File

@@ -10,7 +10,6 @@ use App\Jobs\Dashboard\Service\Store as StoreJob;
use App\Jobs\Dashboard\Service\Update as UpdateJob;
use App\Models\Problem;
use App\Models\ServiceProblem;
use Illuminate\Support\Facades\File;
use Illuminate\Support\Facades\Storage;
class Controller extends ExController
@@ -62,18 +61,8 @@ class Controller extends ExController
public function update(UpdateRequest $request, Service $service)
{
if ($request->hasFile('image')) {
if (env('FILESYSTEM_DISK') == 's3') {
$imagePath = $service->image;
Storage::disk('s3')->delete($imagePath);
} else {
$imagePath = public_path($service->image);
if (File::exists($imagePath)) {
File::delete($imagePath);
}
}
$path = $request->file('image')->store('uploads/services');
Storage::delete($service->image);
$path = $request->file('image')->store('uploads/services');
} else {
$path = $service->image;
}
@@ -106,17 +95,7 @@ class Controller extends ExController
{
$this->authorize('delete', 'services');
if (env('FILESYSTEM_DISK') == 's3') {
$imagePath = $service->image;
Storage::disk('s3')->delete($imagePath);
} else {
$imagePath = public_path($service->image);
if (File::exists($imagePath)) {
File::delete($imagePath);
}
}
Storage::delete($service->image);
ServiceProblem::where('service_id', $service->id)->delete();
$service->delete();