<?php
class Blog_Model extends CI_Model{
        
        function insert($arr)
        {
                
                $this->db->insert('blog_content', $arr);
                return $this->db->insert_id();
                
        }
        
        function update($id, $arr)
        {
        
                $this->db->where('id', $id);
                $this->db->update('blog_content', $arr);
        
        }
        
        function get()
        {       

                    $this->db->select('blog_content.id,blog_content.blog_video,blog_content.blog_image,blog_content.blog_title, blog_content.blog_short_text, blog_content.blog_long_text, blog_content.blog_date, blog_content.facebooklink, blog_content.updated');
                    
                   
                    
                    $this->db->from('blog_content');
                    $this->db->where('deleted', 0);
                     $this->db->order_by("blog_content.blog_date desc");
                    $query=$this->db->get();
                    //echo $this->db->last_query();
                return $query->result();
        }
        
        function get_id($id){
                $this->db->where('id', $id);
                $query = $this->db->get('blog_content');
                return $query->result();
        }
        
        function get_lang($lang)
        {
                
                $this->db->where('lang', $lang);
                $query = $this->db->get('blog_content');
                return $query->result();
                
        }
        
        function delete($id)
        {
                $arr=array();
                $arr['deleted'] =1;
                $this->db->where('id', $id);
                $this->db->update('blog_content', $arr);
        }
        
}

?>