Laravel - Responses - File Downloads

The download method may be used to generate a response that forces the user's browser to download the file at the given path. The download method accepts a filename as the second argument to the method, which will determine the filename that is seen by the user downloading the file. Finally, you may pass an array of HTTP headers as the third argument to the method:

    return response()->download($pathToFile);
    return response()->download($pathToFile, $name, $headers);
Symfony HttpFoundation, which manages file downloads, requires the file being downloaded to have an ASCII filename.