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

@@ -43,20 +43,8 @@ class Update extends FormRequest
public function getImage(Category $category): string
{
if ($this->hasFile('image')) {
if (env('FILESYSTEM_DISK') == 's3') {
// delete old image from s3
Storage::disk('s3')->delete($category->image);
$folder = "uploads/categories";
return (string) $this->file('image')->store($folder);
} else {
// detele old image
if (is_file($category->image)) {
unlink($category->image);
}
return $this->file('image')->store('uploads/categories', 'local');
}
Storage::delete($category->image);
return (string) $this->file('image')->store('uploads/categories');
} else {
return 'null';
}