Several unique fields


Hello, in my database I have a single index with more than one column.


table.unique([‘number’, ‘ddd’])

const rules = {
      ddd: 'required|unique:phones',
      number: 'required|unique:phones'

  const validation = await validate(request.all(), rules)

That way the above validator will check if the ddd column is unique and then verify that the number column is unique and will not check if the two columns together are unique. Does anyone have a solution?


I don’t think there is any default solution for this.
You’ll have to write your own validation rule for this


@duducp Yes rolling your own validation rule is the simplest and the best way to achieve this.

Feel free to ask questions, if you have trouble implementing your own rule