Laravel ajax return excel instead of binary string

using laravel I tried to create excel and add data on it and download(export) it as excel file on client side but instead of excel file to be downloaded it return string. can someone help me please. thanks in advance.

My controller code

use Maatwebsite\Excel\Facades\Excel;
public function exportreport(Request $request){
$file = "users.xlsx";
return Excel::download(new reportExport, $file);
}

my export code

use App\cqqeuryformModel;
class reportExport implements FromCollection
{
public function collection(){
return cqqeuryformModel::all();
}
}

return is string instead of excel file enter image description here

console.log enter image description here

console.log



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/3n8R36j
via IFTTT

تعليقات

المشاركات الشائعة من هذه المدونة

I am unable to figure out how to create payment collection request, after a form has been submitted in laravel

laravel, mysql transaction not working after failed one time