Merge pull request #1554 from theideapeople/patch/doc-rule-arrays
Added documentation for validating arrays.
This commit is contained in:
@@ -55,6 +55,7 @@ Now you are familiar with the basic usage of the Validator class. You're ready t
|
||||
- [E-Mail Addresses](#rule-email)
|
||||
- [URLs](#rule-url)
|
||||
- [Uploads](#rule-uploads)
|
||||
- [Arrays](#rule-arrays)
|
||||
|
||||
<a name="rule-required"></a>
|
||||
### Required
|
||||
@@ -245,6 +246,29 @@ The *mimes* rule validates that an uploaded file has a given MIME type. This rul
|
||||
|
||||
'picture' => 'image|max:100'
|
||||
|
||||
<a name="rule-arrays"></a>
|
||||
### Arrays
|
||||
|
||||
#### Validate that an attribute is an array
|
||||
|
||||
'categories' => 'array'
|
||||
|
||||
#### Validate that an attribute is an array, and has exactly 3 elements
|
||||
|
||||
'categories' => 'array|count:3'
|
||||
|
||||
#### Validate that an attribute is an array, and has between 1 and 3 elements
|
||||
|
||||
'categories' => 'array|countbetween:1,3'
|
||||
|
||||
#### Validate that an attribute is an array, and has at least 2 elements
|
||||
|
||||
'categories' => 'array|countmin:2'
|
||||
|
||||
#### Validate that an attribute is an array, and has at most 2 elements
|
||||
|
||||
'categories' => 'array|countmax:2'
|
||||
|
||||
<a name="retrieving-error-messages"></a>
|
||||
## Retrieving Error Messages
|
||||
|
||||
|
||||
Reference in New Issue
Block a user