Skip to content

Instantly share code, notes, and snippets.

@HigoRibeiro
Created June 6, 2019 18:25
Show Gist options
  • Save HigoRibeiro/b172bde79a6960d0e59eeda282d4a3bb to your computer and use it in GitHub Desktop.
Save HigoRibeiro/b172bde79a6960d0e59eeda282d4a3bb 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