Skip to content

Commit b981817

Browse files
half2melindyhopchris
authored andcommitted
[Docs] Add snake-case validation example to the docs (#472)
1 parent 71fc1a8 commit b981817

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

docs/basics/validators.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,8 @@ Accept: application/vnd.api+json
161161
"type": "posts",
162162
"attributes": {
163163
"title": "Hello World",
164-
"content": "..."
164+
"content": "...",
165+
"another-field": "..."
165166
},
166167
"relationships": {
167168
"author": {
@@ -195,6 +196,7 @@ Your validator will be provided with the following array of data:
195196
"id" => null,
196197
"title" => "Hello World",
197198
"content" => "...",
199+
"another-field" => "...",
198200
"author" => ["type" => "users", "id" => "123"],
199201
"tags" => [
200202
["type" => "tags", "id" => "1"],
@@ -221,6 +223,7 @@ class Validators extends AbstractValidators
221223
return [
222224
'title' => 'required|string|min:1|max:255',
223225
'content' => 'required|string|min:1',
226+
"another-field" => 'string|unique:posts,another_field',
224227
'author' => [
225228
'required',
226229
new HasOne('users'),

0 commit comments

Comments
 (0)