What's the best way to generate a download (in my case of a .txt file) on the fly? By this I mean without storing the file on the server before. For understanding here's what I need to get done:
public function getDesktopDownload(Request $request){
$txt = "Logs ";
//offer the content of txt as a download (logs.txt)
$headers = ['Content-type' => 'text/plain', 'Content-Disposition' => sprintf('attachment; filename="test.txt"'), 'Content-Length' => sizeof($txt)];
return Response::make($txt, 200, $headers);
}