23 lines
611 B
PHP
23 lines
611 B
PHP
<?php
|
|
class Audit_model extends MY_Model {
|
|
|
|
public function get_history($id,$table,$business_id)
|
|
{
|
|
$this->db->select('A.* , users.name as user_name ');
|
|
$this->db->from('history A');
|
|
$this->db->join('users', 'users.id = A.created_by', 'left');
|
|
$this->db->where('md5(A.primary_id)', $id);
|
|
if($business_id != NULL) {
|
|
$this->db->where('A.business_id', $business_id);
|
|
}
|
|
$this->db->where('A.table_name', $table);
|
|
$this->db->order_by('A.id','DESC');
|
|
$query = $this->db->get();
|
|
$query = $query->result();
|
|
return $query;
|
|
}
|
|
|
|
|
|
|
|
|
|
} |