File tree Expand file tree Collapse file tree 1 file changed +10
-17
lines changed Expand file tree Collapse file tree 1 file changed +10
-17
lines changed Original file line number Diff line number Diff line change @@ -34,13 +34,6 @@ protected function getMessages() : array
34
34
return [];
35
35
}
36
36
37
- /**
38
- * The validator.
39
- *
40
- * @return \Illuminate\Contracts\Validation\Validator
41
- */
42
- private $ validator ;
43
-
44
37
/**
45
38
* Returns an instance of the validator from our container.
46
39
*
@@ -59,14 +52,11 @@ private function getValidationFactory() : Factory
59
52
*/
60
53
private function getValidator () : Validator
61
54
{
62
- if (is_null ($ this ->validator )) {
63
- $ this ->validator = $ this ->getValidationFactory ()->make (
64
- $ this ->getData (),
65
- $ this ->getRules (),
66
- $ this ->getMessages ()
67
- );
68
- }
69
- return $ this ->validator ;
55
+ return $ this ->getValidationFactory ()->make (
56
+ $ this ->getData (),
57
+ $ this ->getRules (),
58
+ $ this ->getMessages ()
59
+ );
70
60
}
71
61
72
62
/**
@@ -123,9 +113,12 @@ public function getErrors() : MessageProvider
123
113
*/
124
114
public function getValidationFailureReasons () : array
125
115
{
126
- if ($ this ->isInvalid ()) {
127
- return $ this ->getValidator ()->failed ();
116
+ $ validator = $ this ->getValidator ();
117
+
118
+ if ($ validator ->fails ()) {
119
+ return $ validator ->failed ();
128
120
}
121
+
129
122
return [];
130
123
}
131
124
You can’t perform that action at this time.
0 commit comments