【发布时间】:2020-06-20 17:40:42
【问题描述】:
您好,我真的是使用 maatwebsite 的新手,已经阅读了文档但找不到它,有人可以给我一个关于使用 maatwebsite 导出 excel 后执行查询的想法吗?这是我的代码:
public function export()
{
Excel::download(new KodePosExport, 'KodePos.xlsx');
KodePos::query()->truncate();
return redirect('/')->with('success', 'All good!');
}
它能够重定向到我想要的页面并截断数据但不能导出 excel,我该怎么做?谢谢
如果使用此功能导出 excel 工作正常,但不包括查询
public function export()
{
return Excel::download(new KodePosExport, 'KodePos.xlsx');
//KodePos::query()->truncate();
// return redirect('/')->with('success', 'All good!');
}
【问题讨论】:
-
哪种查询?...发布您迄今为止尝试过的内容(或伪代码以了解您想要的内容)
-
@Berto99 抱歉,我在上面编辑我的问题...你能帮帮我吗?
-
将excel导出到哪里?
-
@lagbox 完美地导出 excel 但不包括查询 = return Excel::download(new KodePosExport, 'KodePos.xlsx');
标签: php laravel maatwebsite-excel