Allowing parameters in custom validation rules function |
According to the documentation (https://codeigniter4.github.io/CodeIgnit...parameters) you can create a custom rule function that accepts parameters but no example of this rule being called is given, so it's unclear how it should be called.
For example, if I have the following function: PHP Code: public function foo(string $bar, string $param, array $formData, string $customError): bool what does the validate call need to look like? I don't see how to add parameters to foo in the call below. PHP Code: if(!$this->validate(['bar' => 'required|foo']))
Perhaps a clearer question is this: https://codeigniter4.github.io/userguide...parameters
The example function they give in that link is called required_with. What would it look like to call required_with as a rule in the validation? They don't give this in the example, so it seems abstract to me.
do like this......... eg
Code: public function validateUser(string $str, string $fields, array $data){ Code: $rules = [ Codeigniter First, Codeigniter Then You!!
yekrinaDigitals
|
Welcome Guest, Not a member yet? Register Sign In |