<?php 

class M_log extends CI_Model{
	public function __construct()
	{
		$this->load->database();
	}
	 
	public function data_log()
	{
		$username = $this->session->userdata("username");  
		$this->db->where('username',$username);
		$query = $this->db->get('tb_admin');
		$row = $query->row();
		$data['id_admin_login']= $row->id;
		$id_admin = $row->id;
		$level = $row->level;
		$id_kantor = $row->id_kantor;
		$cari = $this->input->post('cari'); 
		date_default_timezone_get('Asia/Jakarta');
        $bulan = date('m');
        $tahun = date('Y');
	 
	  
        $this->db->order_by('id','desc');
        $this->db->where('month(tb_log.date)',$bulan);
        $this->db->where('year(tb_log.date)',$tahun);
        $query = $this->db->get('tb_log');
        
        
        return $query->result();
	} 
	 
	 
}