File tree Expand file tree Collapse file tree 1 file changed +2
-7
lines changed
Expand file tree Collapse file tree 1 file changed +2
-7
lines changed Original file line number Diff line number Diff line change 1414use Hyperf \Context \Context ;
1515use Hyperf \Contract \ValidatorInterface ;
1616use Hyperf \HttpServer \Request ;
17+ use Hyperf \Utils \Arr ;
1718use Hyperf \Validation \Contract \ValidatesWhenResolved ;
1819use Hyperf \Validation \Contract \ValidatorFactoryInterface as ValidationFactory ;
1920use Hyperf \Validation \UnauthorizedException ;
@@ -200,13 +201,7 @@ protected function getRules(): array
200201 $ rules = call_user_func_array ([$ this , 'rules ' ], []);
201202 $ scene = $ this ->getScene ();
202203 if ($ scene && isset ($ this ->scenes [$ scene ]) && is_array ($ this ->scenes [$ scene ])) {
203- $ newRules = [];
204- foreach ($ this ->scenes [$ scene ] as $ field ) {
205- if (array_key_exists ($ field , $ rules )) {
206- $ newRules [$ field ] = $ rules [$ field ];
207- }
208- }
209- return $ newRules ;
204+ return Arr::only ($ rules , $ this ->scenes [$ scene ]);
210205 }
211206 return $ rules ;
212207 }
You can’t perform that action at this time.
0 commit comments