public function deletePhoto($path) { $photoPath = public_path('images/uploads/' . $path); try { if (File::isFile($photoPath)) { File::delete($photoPath); } Photo::wherePath($path)->delete(); } catch (Exception $e) { } }
public function deletePhoto($path) { /** * Delete the photo from the directory */ $photoPath = public_path('images/uploads/' . $path); if (File::isFile($photoPath)) { File::delete($photoPath); } /** * Delete the photo from the "photos" table */ Photo::wherePath($path)->delete(); }