Doubt about custom validation |
hi , i have a doubt about custom validation
in controller the rule are : Code: my_validation_function[field_1,field_2] Code: public function my_validation_function(string $str,string $fields, array $data)
If your custom validation rule does not require parameters, you do not need to add any. See the "even" rule in the docs.
For your function/method, you should make the fields arg nullable by adding a ? like so: PHP Code: public function my_validation_function(string $str, ?string $fields, array $data) : bool With that, you should be able to use the $data array from the sent form/user input.
But if i must pass a variable to the function i must insert One , tought the variabile are not the variable that i Need. Because in Array $data there are are post variable.
You can not specify anything in the rules. See how "alpha" "alpha_numeric" are created
$data is an additional, not the main source of checks |
Welcome Guest, Not a member yet? Register Sign In |