<?php
if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Notice_m extends CI_Model{

    public function save_notice($notice)
    {
        $query = $this->db->query("INSERT INTO `notice`(`notice_content`) VALUES ('$notice')");
    }

    public function all_notice()
    {
        $q = $this->db->query("SELECT `id`,`notice_content`, (Case WHEN `status`= 0 THEN 'Hidden' WHEN status = 1 THEN 'Showing' END) as status FROM `notice` WHERE 1");
        return $q->result();
    }

    public function del_notice($id)
    {
        $query = $this->db->query("DELETE FROM `notice` WHERE id = '$id'");
    }
}