public function unique_key($id) { if (!empty($id) and is_string($id) and !ctype_digit($id)) { return 'email'; } return parent::unique_key($id); }