class Myvalidation { public function _validation_unique($val, $options) { list($table, $field) = explode('.', $options); $result = DB::select("LOWER (\"$field\")") ->where($field, '=', Str::lower($val)) ->from($table)->execute(); return ! ($result->count() > 0); } }
$val = Validation::factory(); $val->add_callable('myvalidation');
// orginal $val->add_field('name', 'Name', 'required|nomatch[Name *]'); // array method $val->add_field('name', 'Name', array( 'required', 'nomatch[Name *]', array($modelinstance, 'methodname'), ));
public function _validation_nomatch($val, $input) { return ($val !== $input) ? true : false; }
It looks like you're new here. If you want to get involved, click one of these buttons!