How could I do pagination? The book doesn’t cover about that but I kinda feel pagination is important
@pyae take a look at this community package:
@0xtim I saw that, but it doesn’t support sorting with other column field except id.
You should be able to do it using the QueryBuilder
. Basically sort your items before you call paginate
. So it would be something like:
MyModel.query(on: req).sort(\.name, .ascending).paginate(on: req)
I did that but it shows error
@0xtim Can you please help with this when you get a chance? Thank you - much appreciated! :]
Have you imported Fluent?