I have the following code for Laravel to export a member list as Excel file:
$query = DB::table('tbl_members')->select('ID', 'DOB');
$excel = Exporter::make('Excel');
$excel->loadQuery($query);
return $excel->stream('Members.xlsx');
But using above code, I'm returned an Excel file without any headings and column names.
So what I want is an Excel file which contains the column names in the first row as headings.