loadMax method
Lazily loads the maximum value of a column in a relation.
Stores the max result as an attribute with the suffix _max_{column}.
Example:
await post.loadMax('comments', 'created_at');
final latestComment = post.getAttribute('comments_max_created_at');
Implementation
Future<TModel> loadMax(
String relation,
String column, {
String? alias,
PredicateCallback<OrmEntity>? constraint,
}) async {
return _loadAggregate(
RelationAggregateType.max,
relation,
column,
alias: alias,
constraint: constraint,
);
}