<?php
defined('BASEPATH') or exit('No direct script access allowed');

class Berita_model extends CI_Model
{
    public function get_data($table)
    {
        return $this->db->get($table);
    }

    public function insert_data($data, $table)
    {
        $this->db->insert($table, $data);
    }

    public function update_data($data, $table)
    {
        $this->db->where('id_berita', $data['id_berita']);
        $this->db->update($table, $data);
    }

    public function get_data_by_id($id)
    {
        return $this->db->get_where('tb_berita', ['id_berita' => $id])->row();
    }


    public function delete($where, $table)
    {
        $this->db->where($where);
        $this->db->delete($table);
    }
}
