Pivot Model Instance - Searching by two fields

Hi there,

I have a relationship between Product and Shops (N:M), to do that, I’ve used a pivot model named ProductShop, where I put other info, such as, price and quantity. The problem is I’m not able to update these fields (price and quantity).

I want to retrieve a ProductShop instance, based on product_id and shop_id, using a method like findBy. Is that possible?

Product.js

'use strict'
/** @type {typeof import('@adonisjs/lucid/src/Lucid/Model')} */
const Model = use('Model')

class Product extends Model {
    shops() {
        return this
            .belongsToMany('App/Models/Shop')
            .pivotModel('App/Models/ProductShop')       
    }
}

module.exports = Product

Shop.js

'use strict'

/** @type {typeof import('@adonisjs/lucid/src/Lucid/Model')} */
const Model = use('Model')

class Shop extends Model {

products() {
    return this
        .belongsToMany('App/Models/Product')
        .pivotModel('App/Models/ProductShop')
}

}

module.exports = Shop

ProductShop.js

'use strict'

/** @type {typeof import('@adonisjs/lucid/src/Lucid/Model')} */
const Model = use('Model')

class ProductShop extends Model {
    static boot() {
        super.boot()      
    }
}

module.exports = ProductShop