public function summary() { # check token to make sure request from User that exist in database record if (true || User::isValidToken($_POST['token'])) { # create new object from schedule model $this->schedule = new \models\Schedule(); $note = new Note(); # retrieve note data from database and send the result $user_id = 1; //$_POST['user_id']; $result = array('status' => 'success', 'total_schedule' => $this->schedule->getTotalSchedule($user_id), 'total_incoming' => $this->schedule->getTotalIncoming($user_id), 'total_note' => $note->getTotalNote($user_id), 'incoming' => $this->schedule->getIncomingSchedule($user_id), 'today' => $this->schedule->getTodaySchedule($user_id), 'tomorrow' => $this->schedule->getTomorrowSchedule($user_id)); Utils::prettyPrint(json_encode($result, JSON_PRETTY_PRINT)); } else { # status will be restrict when token does not exist ini database record $result = array('status' => 'restrict'); Utils::prettyPrint(json_encode($result, JSON_PRETTY_PRINT)); } }