Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
syncEnrollments
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Yeray Santana Hualde
syncEnrollments
Commits
6b18fc2b
Commit
6b18fc2b
authored
Dec 31, 2012
by
Ken Stanley
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added documentation for validating arrays.
parent
8ff052cb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
2 deletions
+26
-2
validation.md
laravel/documentation/validation.md
+26
-2
No files found.
laravel/documentation/validation.md
View file @
6b18fc2b
...
...
@@ -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
...
...
@@ -321,11 +345,11 @@ This will also work great when we need to conditionally add classes when using s
For example, if the email address failed validation, we may want to add the "error" class from Bootstrap to our
*div class="control-group"*
statement.
<div class="control-group {{ $errors->has('email') ? 'error' : '' }}">
When the validation fails, our rendered view will have the appended
*error*
class.
<div class="control-group error">
<a
name=
"custom-error-messages"
></a>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment