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)
1616 $ this ->requireParameters ($ this ->fillable_params );
1717
1818 $ field = $ this ->parameter ('field ' );
19- $ anotherValue = $ this ->validation ->getValue ($ field );
19+ $ anotherValue = $ this ->getAttribute () ->getValue ($ field );
2020
2121 return $ value == $ anotherValue ;
2222 }
Original file line number Diff line number Diff line change @@ -876,4 +876,28 @@ public function testRequiredUnlessOnArrayAttribute()
876876 $ this ->assertNotNull ($ errors ->first ('products.14.notes ' ));
877877 }
878878
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+
879903}
You can’t perform that action at this time.
0 commit comments