Pluck / ids() as Array or Serialize


I am using ids() to get the ids of Pivot Record. Refer to the code below:

const addon = await Addon.query().with('packages')

const package_ids = addon.packages().ids()

In my view I am trying to check If a certain element/value is in package_ids variable. It’s not returning an array or a JSON object. How can I serialize it? I tried using toJSON() / JSON.Stringify(), but nothing seems to work.



It has to be await addon.packages().ids(), basically await is missing