aggregation

ORM also provides various aggregation methods such as count, max, min, avg, and sum. You can call any method after constructing the query:

max

$max = TestUserListModel::create()->max('age');

min

$min = TestUserListModel::create()->min('age');

count

// count No need to pass field name
$count = TestUserListModel::create()->count();

avg

$avg = TestUserListModel::create()->avg('age');

sum

$sum = TestUserListModel::create()->sum('age');