12-06-2018, 11:34 PM
Hi, I want to create custom validation rule but it not working.
Config/Validation
App\Model
Result
For additional question, can someone give simpler example how to send parameters to the function? I don't get the 'require_with' example.
https://codeigniter4.github.io/CodeIgnit...-parameter
The new validation system is hard to understand compared to the previous callback system.
Config/Validation
Code:
public function test_validate(string $str, string &$error = null): bool
{
$error = 'test error';
return false;
}
App\Model
Code:
protected $validationRules = array(
'name' => 'required|test_validate'
);
Result
Quote:CodeIgniter\Validation\Exceptions\ValidationException
{0} is not a valid rule.
For additional question, can someone give simpler example how to send parameters to the function? I don't get the 'require_with' example.
https://codeigniter4.github.io/CodeIgnit...-parameter
The new validation system is hard to understand compared to the previous callback system.