public function getCount($sql, Array $args) {
$stmt = $this->connection->prepare($sql);
if ( $stmt->execute($args) ) {
return $stmt->rowCount();
}
return false;
// return $this->connection->query($sql)->rowCount();
}
public function checkCode( $code ) {
$data = [
'code' => $code
];
$sql = "SELECT `id` FROM `$this->table` WHERE `code` = :code";
return $this->model->getCount( $sql, $data );
}