public function checkCode( $code ) {
$sql = "SELECT `id` FROM `$this->table` WHERE `code` = '$code'";
return $this->model->getCount( $sql );
}
/**
* model
/*
public function getCount($sql) {
return $this->connection->query($sql)->rowCount();
}