test
This commit is contained in:
@@ -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';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user