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