【发布时间】:2022-08-18 17:30:01
【问题描述】:
api
Route::get(\'UserExport\', function (UserRequest $request) {
return Excel::download(new UserExportExcel($request->id), \'UserReport.xlsx\');
});
用户导出Excel
private $id;
public function __construct(int $id)
{
$this->id = $id;
}
public function collection()
{
$filePath = storage_path(\'app/Users/\'.$this->id . \'.xlsx\'); //file name is 15.xlsx which is the id +.xlsx
User::all()->downloadExcel(
$filePath,
);
}
我试图在不使用模型的情况下导出我的 excel 文件!
标签: php laravel export export-to-excel maatwebsite-excel