Here's my environment
php : 7.4.2
laravel : 6.14.0
maatwbsite-excel : 3.1.18
Here's the export file
namespace App\Exports;
use Illuminate\Support\Collection;
use Maatwebsite\Excel\Concerns\Exportable;
use Maatwebsite\Excel\Concerns\FromArray;
class UserReportsExport implements FromArray
{
use Exportable;
protected $export_columns;
function __construct($export_columns)
{
$this->export_columns = $export_columns;
}
public function array(): array
{
return [
$this->export_columns
];
}
}
Here's the controller
return Excel::download(new UserReportsExport($export_columns), 'Users_Report_' . $todayDate . '.xlsx');
Here is the link that came close to the issue. Based on the solution suggested, I am using return
in my controller but still the page is coming blank/empty BUT in my /tmp
folder there a .zip
like laravel-excel-***
is generated (all it includes are .xml files).
Not sure what I'm missing here. Please suggest. Thanks.