samedi 29 juin 2019

Excel Export using laravel with vuejs

I am Doting Excel export using Laravel with Vuejs, somehow the Code is returning true value but can not Download Excel file, if I do normal request it will download the file, but in axios request, it will not export the file

I am using php artisan make:export to export file

In App/Export/studentexport.php

public function collection()
{
    return Student_master::all();
}

then in controller i will do a function

public function export()
{
    return Excel::download(new StudentExport, 'users.xlsx');
}

In my Vue file i will write a code that cal call the controller and export the file

axios.get('api/export')
            .then(()=>{
                toast({
                    type: 'success',
                    title: 'Export the Data'
                })
            })
            .catch(()=> {
                toast({
                        type: 'warning',
                        title: 'Can not Export'
                        })
            })

but the result is like that enter image description here

that will return True, I really don't know how to solve this,plase help me



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire