adonis make:model Model -mc
Sometimes you want to be able to query a model, but not return data in that model. A good example of this is when querying a user model. You really don't want to be returning the password, hashed or not.
To do this, open the relevant model file (e.g. app/Models/User.js) and add the following:
static get hidden () {
return ['password']
}
Whatever you pass into the return object (as individual strings) will not be returned in any query.
Adonis does not include validation out of the box. You need to install it using the command:
adonis install @adonisjs/validator
You also need to add the package to the Service Provider:
const providers = [
'@adonisjs/validator/providers/ValidatorProvider'
]
Adonis uses a library called Indicative to provided validation rules. All available rules are listed here.