File tree Expand file tree Collapse file tree
src/Illuminate/Validation Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -314,19 +314,31 @@ protected function validate($attribute, $rule)
314314 $ this ->addFailure ($ attribute , $ rule , $ parameters );
315315 }
316316 }
317-
317+
318318 /**
319- * Returns the data which have been successfully validated
319+ * Returns the data which was valid.
320320 *
321321 * @return array
322322 */
323- public function passed ()
323+ public function valid ()
324324 {
325325 if ( ! $ this ->messages ) $ this ->passes ();
326-
326+
327327 return array_diff_key ($ this ->data , $ this ->messages ()->toArray ());
328328 }
329329
330+ /**
331+ * Returns the data which was invalid.
332+ *
333+ * @return array
334+ */
335+ public function invalid ()
336+ {
337+ if ( ! $ this ->messages ) $ this ->passes ();
338+
339+ return array_intersect_key ($ this ->data , $ this ->messages ()->toArray ());
340+ }
341+
330342 /**
331343 * Get the value of a given attribute.
332344 *
You can’t perform that action at this time.
0 commit comments