dimanche 8 novembre 2020

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 ajax return

console.log



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire