<?php
class Haberler_model extends CI_Model {

    public $tableName = "haberler";

    public function __construct()
    {
        parent::__construct();
    }



    public function get($where = array())
    {
        return $this->db->where($where)->get($this->tableName)->row();
    }

    /*VERİ TABANINDAN TÜM KAYITLARI GETİREN METHOD*/
    public function get_all($where = array(), $order = "id DESC") {
        return $this->db->where($where)->order_by($order)->get($this->tableName)->result();
    }


    public function get_all_like($where = array(), $order = "id DESC") {
        return $this->db->like($where)->order_by($order)->get($this->tableName)->result();
    }


    /*veri tabanına kayıt ekleyen modül*/
    public function add($data = array())
    {
        return $this->db->insert($this->tableName, $data);
    }


    //KAYIT GÜNCELLE
    public function update($where = array(), $data = array())
    {
        return $this->db->where($where)->update($this->tableName, $data);
    }


    //KAYIT SİL
    public function delete ($where = array())
    {
        return $this->db->where($where)->delete($this->tableName);
    }
}
