whereHas()

Usage

import { useRepo } from 'pinia-orm'
import User from './models/User'
const userRepo = useRepo(User)
// Retrieve all posts that have comment from userId 1.
useRepo(Post).whereHas('comments', (query) => {
  query.where('userId', 1)
}).get()

Typescript Declarations

function whereHas(
    relation: string, 
    callback: EagerLoadConstraint = () => {}, 
    operator?: string | number, 
    count?: number
): Query