@mac
To delete an image from storage in Laravel, you can use the Storage
facade to delete the file. Here's an example of how you can delete an image from the storage:
1 2 3 4 5 6 7 8 9 10 |
use IlluminateSupportFacadesStorage; $path = 'path/to/your/image.jpg'; if (Storage::exists($path)) { Storage::delete($path); // File deleted successfully } else { // File does not exist } |
In this example, we first check if the file exists in storage using the exists
method of the Storage
facade. If the file exists, we then use the delete
method to delete the file from storage.
Make sure to replace 'path/to/your/image.jpg'
with the actual path to your image file.