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() {
  this.select('id', 'division_id').from('employees')
    .where('employees.division_id', 1000)
    .as('subquery')
  }).leftJoin('benefits', 'subquery.id', 'benefits.employee_id').where('subquery.division_id', this.payload.id).fetch()

You can pass it to your function()

.from(function(myParam) { ...