-
I have a paginated route: export default class GamesController {
public async index({ request }: HttpContextContract) {
return query.paginate(
request.input('page', 1),
request.input('perPage', 10)
);
}
} It sends response: I have converted attributes in data to camelCase. However, I cannot convert attributes in |
Beta Was this translation helpful? Give feedback.
Answered by
guoyunhe
Jan 17, 2023
Replies: 1 comment
-
Found it in document https://docs.adonisjs.com/reference/orm/naming-strategy#paginationmetakeys: import { string } from '@ioc:Adonis/Core/Helpers'
import { SnakeCaseNamingStrategy, BaseModel } from '@ioc:Adonis/Lucid/Orm'
class CamelCaseNamingStrategy extends SnakeCaseNamingStrategy {
public paginationMetaKeys() {
return {
total: 'total',
perPage: 'per_page',
currentPage: 'current_page',
lastPage: 'last_page',
firstPage: 'first_page',
firstPageUrl: 'first_page_url',
lastPageUrl: 'last_page_url',
nextPageUrl: 'next_page_url',
previousPageUrl: 'previous_page_url',
}
}
} |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
guoyunhe
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Found it in document https://docs.adonisjs.com/reference/orm/naming-strategy#paginationmetakeys: