bbone/application/modules/Business/models/Business_model.php
2023-01-02 12:01:17 +05:30

44 lines
1.1 KiB
PHP

<?php
class Business_model extends MY_Model {
public function get_business_details()
{
$this->db->select('B.* , state.name as state_name ');
$this->db->from('business B');
$this->db->join('state', 'state.id = B.state', 'left');
$this->db->order_by('B.id','ASC');
$this->db->where('B.is_active', 1);
$query = $this->db->get();
$query = $query->result();
return $query;
}
public function get_business_by_md5_id($id)
{
$this->db->select('B.* , state.name as state_name ');
$this->db->from('business B');
$this->db->join('state', 'state.id = B.state', 'left');
$this->db->where('B.is_active', 1);
$this->db->where('md5(B.id)', $id);
$query = $this->db->get();
$query = $query->row();
return $query;
}
public function delete_by_md5_id($id,$business_id,$table)
{
$this->db->where('md5(id)', $id);
$this->db->where('business_id', $business_id);
$this->db->set('is_active',0);
$this->db->update($table);
return;
}
}