latest method

Generator latest({
  1. String? columName,
})
inherited

Get latest row related to primary key. You can specify the column name.

var userEloquent = UserEloquent();

 // Get latest user by 'id' which is primary key.
userEloquent.latest().get();

// Get latest user by 'name';
userEloquent.latest(columnName:'name').get();

Implementation

Generator latest({String? columName}) {
  _orderBy = columName ?? getPrimaryColumn;
  _offset = 0;
  _sort = Sort.descending;
  _limit = 1;
  return this;
}