public function post_delete() { if (!isset($_POST['id'])) { return $this->error('Missing parameter: id'); } if (!isset($_POST['user'])) { return $this->error('Missing parameter: user'); } $note = new \user\Note($_POST['id']); if ($note->error) { error_log($note->error); return $this->error('An unexpected error occurred.'); } if (!$note->remove()) { error_log($note->error); return $this->error('An unexpected error occurred.'); } return $this->get__default($_POST['user']); //return true; }
/** * Get all notes for the current user. * Alias of `user\Note::for_user ($user_id)` */ public function notes() { return user\Note::for_user($this->id); }