This tutorial is for the Delete Laravel storage folder image. Laravel in creating a storage folder this command php artisan storage:link
. and you can store images in the storage folder.
Laravel image uploading is quite simple and you can upload multiple images and store them in the database. Sometimes, we require to upload or remove images of any existing record.
public function delete($id)
{
$post = Post::find($id);
if(Storage::exists($post->image)) { // check if image exist
\Storage::delete($post->image); // delete existing image from storage
}
return redirect()->back();
}
Thank You