File tree Expand file tree Collapse file tree 2 files changed +25
-1
lines changed Expand file tree Collapse file tree 2 files changed +25
-1
lines changed Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ public function check($value)
16
16
$ this ->requireParameters ($ this ->fillable_params );
17
17
18
18
$ field = $ this ->parameter ('field ' );
19
- $ anotherValue = $ this ->validation ->getValue ($ field );
19
+ $ anotherValue = $ this ->getAttribute () ->getValue ($ field );
20
20
21
21
return $ value == $ anotherValue ;
22
22
}
Original file line number Diff line number Diff line change @@ -876,4 +876,28 @@ public function testRequiredUnlessOnArrayAttribute()
876
876
$ this ->assertNotNull ($ errors ->first ('products.14.notes ' ));
877
877
}
878
878
879
+ public function testSameRuleOnArrayAttribute ()
880
+ {
881
+ $ validation = $ this ->validator ->validate ([
882
+ 'users ' => [
883
+ [
884
+ 'password ' => 'foo ' ,
885
+ 'password_confirmation ' => 'foo '
886
+ ],
887
+ [
888
+ 'password ' => 'foo ' ,
889
+ 'password_confirmation ' => 'bar '
890
+ ],
891
+ ]
892
+ ], [
893
+ 'users.*.password_confirmation ' => 'required|same:users.*.password ' ,
894
+ ]);
895
+
896
+ $ this ->assertFalse ($ validation ->passes ());
897
+
898
+ $ errors = $ validation ->errors ();
899
+ $ this ->assertNull ($ errors ->first ('users.0.password_confirmation:same ' ));
900
+ $ this ->assertNotNull ($ errors ->first ('users.1.password_confirmation:same ' ));
901
+ }
902
+
879
903
}
You can’t perform that action at this time.
0 commit comments