<?php

defined('BASEPATH') OR exit('No direct script access allowed');

class Whatsnew extends MY_Controller {

    public function latest_post() {
        $username = $this->input->post('un');
        $this->load->model('Whatsnew_model', 'whatsnews_model');
        $data = $this->whatsnews_model->get_latest_news($username);
        $ret = array('error' => 0, 'success' => (count($data) == 0) ? false : true, 'data' => $data);
        $this->response($ret, MY_Controller::HTTP_OK);
    }

    public function get_post() {
        $username = $this->input->post('un');
        $news_id = $this->input->post('id');
        $this->load->model('Whatsnew_model', 'whatsnews_model');
        $data = $this->whatsnews_model->get_news($news_id, $username);
        $ret = array('error' => 0, 'success' => (count($data) == 0) ? false : true, 'data' => $data);
        $this->response($ret, MY_Controller::HTTP_OK);
    }

}
