How to pass an argument to nested query?

Is there a way to pass in an argument to an anonymous function so I may avoid hardcoding the “1000”? Since “this” refers to the database object, I do not know how to reference variables outside the anonymous function?

const query = await Employee.query().select('*').from(function() {'id', 'division_id').from('employees')
    .where('employees.division_id', 1000)
  }).leftJoin('benefits', '', 'benefits.employee_id').where('subquery.division_id',