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

class Setting_model extends MY_Model {

    public $table = 'setting';

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


    public function set($key, $value){
        $this->db->where('key', $key);
        $this->db->update($this->table, array('value' => $value));
    }

    public function get($key){
        $this->db->where('key', $key);
        return $this->db->get($this->table)->row_array();
    }

    public function get_keys($keys){
        $this->db->where_in('key',$keys);
        $result = $this->db->get($this->table)->result_array();
        
        foreach($result as $row){
            $kv[$row['key']] = $row['value'];
        }

        return $kv;
    }   

}