We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Storage::delete with the local driver always returns true:
public function delete($paths) { $paths = is_array($paths) ? $paths : func_get_args(); foreach ($paths as $path) { try { $this->driver->delete($path); } catch (FileNotFoundException $e) { // } } return true; }
This is not helpful when attempting to first confirm an object's associated file upload was successfully deleted before deleting the object itself.
Since the local filesystem driver already returns the correct result:
public function delete($path) { $location = $this->applyPathPrefix($path); return unlink($location); }
Why can't we change the delete function in FilesystemAdapter to:
public function delete($paths) { $paths = is_array($paths) ? $paths : func_get_args(); $success = true; foreach ($paths as $path) { try { $success = $this->driver->delete($path); } catch (FileNotFoundException $e) { $success = false; } } return $success; }
I'm relatively new to Laravel, so apologies if I've missed a more appropriate way to handle this -- thank you either way.
The text was updated successfully, but these errors were encountered:
I would suggest that you do it like this:
if ($this->driver->has($path)) { $this->driver->delete($path); }
Sorry, something went wrong.
Thank you for the reply, but that doesn't handle the case when a delete fails.
e68358d
Thank you for the fix.
No branches or pull requests
Storage::delete with the local driver always returns true:
This is not helpful when attempting to first confirm an object's associated file upload was successfully deleted before deleting the object itself.
Since the local filesystem driver already returns the correct result:
Why can't we change the delete function in FilesystemAdapter to:
I'm relatively new to Laravel, so apologies if I've missed a more appropriate way to handle this -- thank you either way.
The text was updated successfully, but these errors were encountered: