-
Not able to delete image file in Laravel
Iam trying to delete an image file but its giving error that call to a member function delete() on string.
This is my code:
public function destroy($id) { $element = Element::find($id); $destination = 'public/images/'.$element->imagen; if(File::exists($destination)){ File::delete($destination); } $destination->delete(); return redirect()->route('elements.index'); } }
-
April 16, 2025
APIs and external services