mariusticha
mariusticha
FFilament
Created by mariusticha on 11/16/2023 in #❓┊help
validation ->in() rule is not executed when checking against an empty array
hey guys, we just encountered a problem with the ->in() rule on the form builder. we try to validate user input against (in some cases) an empty array. we expected the rule to fail, since the user input is obviously not present in an empty array. after some research in the implementation, we've found this line: https://github.com/filamentphp/filament/blob/3.x/packages/forms/src/Components/Concerns/CanBeValidated.php#L227 saying that the >in() rule is only validated, if the array to validate against is not empty. does anybody know why the rule is implemented like this? for some special reason? please note that the underlying laravel's in rule fails against an empty array and since there is no information in the docs about this, we expected the filament rule to work in the same way. cheers
9 replies