selected(); $carbonMonth = Carbon::create($yearPeriod->year, $month->toCarbonNumber()); $users = User::query() ->orderBy("last_name") ->orderBy("first_name") ->get(); $filename = "{$carbonMonth->translatedFormat("F Y")}.xlsx"; $timesheet = (new TimesheetExport()) ->forMonth($carbonMonth) ->forUsers($users); return Excel::download($timesheet, $filename); } }