[Welcome] Claim Notes, API Keys

This commit is contained in:
Peter Goodhall
2022-10-10 15:06:01 +01:00
parent d7efc67f99
commit cd44097d66
4 changed files with 102 additions and 4 deletions

View File

@@ -41,6 +41,27 @@ class Note extends CI_Model {
return $this->db->get('notes');
}
function ClaimAllNotes($id = NULL) {
// if $id is empty then use session user_id
if (empty($id)) {
// Get the first USER ID from user table in the database
$id = $this->db->get("users")->row()->user_id;
}
$data = array(
'user_id' => $id,
);
$this->db->update('notes', $data);
}
function CountAllNotes() {
// count all notes
// where user_id is not NULL
$this->db->where('user_id !=', NULL);
return $this->db->count_all('notes');
}
}
?>