\Valitron\Validator::addRule('chkVAT', function($field, $value, array $params, array $fields) {
if ($value) {
$query = $this->db->query("SELECT * FROM customers where (vat = '".$value."') AND (id <> ".$params[0].")");
if (empty($query->result())) {
return true;
} else {
return false;
}
} else {
// not validate empty docs
return true;
}
return false;
}, ', another customer has the same VAT.');
and the setRULE call...
$crud->setRule('vat', 'chkVAT',[ $crud->$fields->id]);
How can I get the ACTIVERECORD ID inside VALITRON or how can I pass it as a parameter???
thx in advance!...
