include method

Model include(
  1. String relation, [
  2. dynamic callback(
    1. Model qb
    )?
])

Implementation

Model include(String relation, [Function(Model qb)? callback]) {
  if (!_relationsRegistered) {
    registerRelations();
    _relationsRegistered = true;
  }

  final rela = _relations[relation];
  if (rela != null && rela is MorphTo) {
    where(rela.morphType, '=', rela.type!);
  }

  _withRelation.add(_RelationQuery(relation, callback));
  return this;
}