Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
U
UserAdminV2
Overview
Overview
Details
Activity
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
庄欣
UserAdminV2
Commits
fc820e73
Commit
fc820e73
authored
Oct 16, 2011
by
Taylor Otwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
continuing to refactor the validator.
parent
4f560fdf
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
4 deletions
+10
-4
laravel/validation/validator.php
+10
-4
No files found.
laravel/validation/validator.php
View file @
fc820e73
...
@@ -496,10 +496,9 @@ class Validator {
...
@@ -496,10 +496,9 @@ class Validator {
* Get the proper error message for an attribute and rule.
* Get the proper error message for an attribute and rule.
*
*
* Developer specified attribute specific rules take first priority.
* Developer specified attribute specific rules take first priority.
* Developer specified error rules take second priority.
* Developer specified error rules take second priority. If the error
*
* message has not been specified by the developer, the default will
* If the message has not been specified by the developer, the default
* be used from the validation language file.
* will be used from the validation language file.
*
*
* @param string $attribute
* @param string $attribute
* @param string $rule
* @param string $rule
...
@@ -507,14 +506,21 @@ class Validator {
...
@@ -507,14 +506,21 @@ class Validator {
*/
*/
protected
function
message
(
$attribute
,
$rule
)
protected
function
message
(
$attribute
,
$rule
)
{
{
// First we'll check for developer specified, attribute specific messages. These messages
// take first priority if they have been specified. They allow the fine-grained tuning
// of error messages for each rule.
if
(
array_key_exists
(
$attribute
.
'_'
.
$rule
,
$this
->
messages
))
if
(
array_key_exists
(
$attribute
.
'_'
.
$rule
,
$this
->
messages
))
{
{
return
$this
->
messages
[
$attribute
.
'_'
.
$rule
];
return
$this
->
messages
[
$attribute
.
'_'
.
$rule
];
}
}
// Next we'll check for developer specified, rule specific messages. These allow the
// developer to override the error message for an entire rule, regardless of the
// attribute being validated by that rule.
elseif
(
array_key_exists
(
$rule
,
$this
->
messages
))
elseif
(
array_key_exists
(
$rule
,
$this
->
messages
))
{
{
return
$this
->
messages
[
$rule
];
return
$this
->
messages
[
$rule
];
}
}
// If the
elseif
(
in_array
(
$rule
,
$this
->
size_rules
)
and
!
$this
->
has_rule
(
$attribute
,
$this
->
numeric_rules
))
elseif
(
in_array
(
$rule
,
$this
->
size_rules
)
and
!
$this
->
has_rule
(
$attribute
,
$this
->
numeric_rules
))
{
{
$line
=
(
array_key_exists
(
$attribute
,
Input
::
file
()))
?
"file"
:
"string"
;
$line
=
(
array_key_exists
(
$attribute
,
Input
::
file
()))
?
"file"
:
"string"
;
...
...
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