Skip to content

Commit

Permalink
fix: allow dependency injection on form request rules (#1045)
Browse files Browse the repository at this point in the history
  • Loading branch information
bytestream authored Feb 6, 2025
1 parent 934bc59 commit 5a5053f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/JsValidatorFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ private function newFormRequestValidator($formRequest, $selector)
// Replace all rules with Noop rules which are checked client-side and always valid to true.
// This is important because jquery-validation expects fields under validation to have rules present. For
// example, if you mark a field as invalid without a defined rule, then unhighlight won't be called.
$rules = method_exists($formRequest, 'rules') ? $formRequest->rules() : [];
$rules = method_exists($formRequest, 'rules') ? $this->app->call([$formRequest, 'rules']) : [];
foreach ($rules as $key => $value) {
$rules[$key] = 'proengsoft_noop';
}
Expand Down

0 comments on commit 5a5053f

Please sign in to comment.