whereHas()

Add a "where has" clause to the query.


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