<?php defined('SYSPATH') or die('No direct script access.');

class Auth_Group_Model extends Model {

	function __construct(){ 
		
			$this->db = new Database();  

	}
	//取得所有用户组
	public function grouplist(){
		return $this->db->get('user_group');

	}
	
	public function checklist($name,$value){
		$this->db->orwhere(array('group_name' => $name, 'group_value' => $value));
		return $this->db->get('user_group');

	}
	
	public function getone($id){
		$this->db->where('group_id', $id);
		return $this->db->get('user_group');

	}
	
	function add($data){
		return $this->db->insert('user_group',$data);

	}
	
	function delete($id_list){
				$this->db->delete('menu_group',array('group_id'=>$id_list['group_id']));
		return $this->db->delete('user_group',$id_list);
	}
	
	function edit($data){
		$this->db->where('group_id', $data['group_id']);
		return $this->db->update('user_group', $data);

	}
	
} // End Auth Role Model 