Created
June 4, 2014 22:28
-
-
Save kamaulynder/0fd6311cb39fdbce6486 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Get a count of tags,posts,sets,users | |
| * | |
| * GET /api/stats | |
| * | |
| * @return void | |
| */ | |
| public function action_get_index_collection() | |
| { | |
| //Count of all tags | |
| $tags_query = ORM::factory('Tag') | |
| ->order_by($this->_record_orderby, $this->_record_order) | |
| ->offset($this->_record_offset) | |
| ->limit($this->_record_limit); | |
| $tags = $tags_query->find_all(); | |
| $count = $tags->count(); | |
| //Count of all posts | |
| $posts_query = ORM::factory('Post') | |
| ->order_by($this->_record_orderby, $this->_record_order) | |
| ->offset($this->_record_offset) | |
| ->limit($this->_record_limit); | |
| $posts = $posts_query->find_all(); | |
| $count = $posts->count(); | |
| // Respond with count | |
| $this->_response_payload = array( | |
| 'count' => $count | |
| ); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment