You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/docs/guides/validation.md
+6-30Lines changed: 6 additions & 30 deletions
Original file line number
Diff line number
Diff line change
@@ -34,8 +34,8 @@ The rule is a macro for `VineString` and `VineNumber`, so you can use it after `
34
34
35
35
You may either pass a callback to query the database directly, or an object:
36
36
37
-
- The callback must return `true` if the value is unique (does not exist), or `false` if the value already exists.
38
-
- You may also pass an options object to specify the table and column.
37
+
- The [callback](https://github.com/adonisjs/lucid/blob/21.x/src/types/vine.ts#L61-L65) must return `true` if the value is unique (does not exist), or `false` if the value already exists.
38
+
- You may also pass an [options object](https://github.com/adonisjs/lucid/blob/21.x/src/types/vine.ts#L17-L55) to specify the table and column.
39
39
40
40
```ts
41
41
// Usage with callback
@@ -56,22 +56,10 @@ const schema = vine.object({
56
56
.string()
57
57
// highlight-start
58
58
.unique({ table: 'users', column: 'email' }),
59
-
// highlight-end
59
+
// highlight-end
60
60
})
61
61
```
62
62
63
-
Following is the list of available parameters for the unique rule:
0 commit comments