有人可以帮助我吗?我想出口 excel。这是我的控制器代码
public function export() {
$data['stok'] = Stokbarang::with('products')->get();
$tgl = thisDay();
return Excel::create('Stok'.$tgl, function($excel) use ($index) {
$excel->sheet('New sheet', function($sheet) use ($data) {
$sheet->loadView('panel.stok.excel',$data);
});
})->export('xls');
}
但是它不会返回 Excel 文件。它像这样返回而不是一个 excel 文件
我该怎么办?请有人帮我解决这个问题。
1 回答
已解决。这是因为在返回数据表的资源根与我的导出路由之间存在冗余路由。