0
votes

I'm using the Maatwebsite/Laravel-Excel 3.1 version library in Laravel to download an xlsx file. its working fine in localhost but not working in live server.

UsersExport

namespace App\Exports;

use App\Exports\UsersExport;
use Maatwebsite\Excel\Concerns\FromCollection;
use DB;
class UsersExport implements FromCollection
{

    public function collection()
    {
        return DB::table('employees')->get();
    }

}
Controller

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use DB;
use Excel;
use App\Exports\UsersExport;

class MyController extends Controller
{
    public function export(){
        return Excel::download(new UsersExport, 'users.xlsx');
    }
}

result

enter image description here

1
dose my answer satisfy you?Abilogos

1 Answers

0
votes

your local host collation is different from servers.

try to make servers db collation like your local.