Skip to content

Instantly share code, notes, and snippets.

@tridungle
Forked from HigoRibeiro/Validator.js
Created December 22, 2020 10:51
Show Gist options
  • Save tridungle/16b2f2dd19991ac9af9c9a989647ad93 to your computer and use it in GitHub Desktop.
Save tridungle/16b2f2dd19991ac9af9c9a989647ad93 to your computer and use it in GitHub Desktop.
Validação condicional
class Store {
get validateAll () {
return true
}
get rules () {
return {
...(this.ctx.request.input('name') ? { name : 'required' } : null),
email: 'required|email|unique:users',
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment