function createCSVFile($results) { $csvPath = SettingsStorage::settings()["csv_file_locations"]; $rand = Utils::generateRandomString(10) . '.csv'; $results->asCSV(FileStorage::getPath($rand, $csvPath)); return $rand; }