whereHas abstract method

QueryBuilderInterface<T> whereHas(
  1. String relation, [
  2. void callback(
    1. QueryBuilderInterface query
    )?,
  3. String operator = '>=',
  4. int count = 1,
])

Query for existence of a relationship with optional constraints Equivalent to Laravel's whereHas()

Example:

Post.query().whereHas('comments', (q) => q.where('approved', '=', true))

Implementation

QueryBuilderInterface<T> whereHas(
  String relation, [
  void Function(QueryBuilderInterface<dynamic> query)? callback,
  String operator = '>=',
  int count = 1,
]);