Lucid give parameter to buider


#1

Hi.

How can I send a variable to the Lucid builder filter?

this doesn’t work as the query doesn’t recognize userId variable.

    let userId = user.id
    let feedLine = await Feed
      .query()
      .with('user',(builder )=>{
        builder.wherePivot('id', userId)
      })
      .fetch()

#2

Ok, I found my mistake. I ommited await on
user = await auth.getUser()

Please close