I am using Indicative in my project to validate my controller, but, Indicative don’t have a “Unique” rule in “Validation Rules”, but the framework Adonis have a rule call “unique” that does exactly what i need.
My project is made in Adonis, but i prefer to use “Indicative” and not “Validator” in Adonis, because i think is more easy and beautiful write the code direct in the Controller
code: 'required|string|max:255', description: 'required|string|max:255|unique:tabela', authors: 'string|max:255', status: 'boolean', user_id: 'integer', created_at: [ importValidate.validations.dateFormat(['YYYY-MM-DD HH:mm:ss']) ], updated_at: [ importValidate.validations.dateFormat(['YYYY-MM-DD HH:mm:ss']) ] }
In the example above, I need the “code” to be “Unique” and return an error message and a response status. How can I do this?