Actually my table users have one column called permission
that stores values: 1,2 and 3.
I have this query that i return all users and i need to replace the value permissions to: 1 replace to 'Admin' 2 replace to 'Normal User' 3 replace to 'Students'
I try this way:
async index({request}) {
const page = request.input('page')
const pageSize = request.input('pageSize')
const users = await User.query().paginate(page, pageSize)
for(let i=0; i<users.rows.User;i++){
console.log(users)
if(users[i].rows.User.permission === 1){
users[i].rows.User.permission = 'Admin'
}
}
return users
}
But my for() is not findind the users. How i can change this value? There's a way to do this using the lucid models?