I want to delete a News from database and when I hit the delete button all data from database deleted but the image is remains in upload folder. So, how do I this to work. t
Two ways to delete the image from public folder without changing laravel filesystems config file or messing with pure php unlink function:
- Using the default local storage you need to specify public subfolder:
Storage::delete('public/'.$image_path);
- Use public storage directly:
Storage::disk('public')->delete($image_path);
I would suggest second way as the best one.
Hope this help other people.