流明,如何加载项目外的文件

Lumen, How to load a file that is out of the project

我的用户的文档文件夹中有一个 pdf 文件,我需要通过某个途径return。 为此,我编写了以下简单函数

public function showPdf(){
    return response()->file('/home/victor/Documents/1-39-1.pdf');
}

但是当我通过 GET 调用此函数时,浏览器return出现以下异常

Method Laravel\Lumen\Http\ResponseFactory::file does not exist.

如何告诉 lumen 我的文件在那个路径上?

在流明7.x这个方法名为download,可以看到here。这与 Laravels file() 非常相似,因此此更改应该有效。

return response()->download('/home/victor/Documents/1-39-1.pdf');