Current File : /home/giriqfky/public_html/Barga/application/modules/customers/models//Customers_model.php
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Customers_model extends CI_Model
{
var $table_app_customer = TABLE_CUSTOMER;
var $table_app_users = TABLE_USERS;
// var $table_app_settings = TABLE_APP_SETTINGS;
// var $table_customer = TABLE_APP_USERS;
// var $table_app_user_addresses = TABLE_APP_USER_ADDRESSES;
// var $table_customer_ratings = TABLE_CUSTOMER_RATINGS;
// var $table_job_posts = TABLE_JOB_POSTS;
// var $table_services = TABLE_SERVICES;
// var $table_service_provider_ratings = TABLE_SERVICE_PROVIDER_RATINGS;
public function __construct()
{
parent::__construct();
}
public function getCustomerList($params = array())
{
$this->db->select('*');
$this->db->from($this->table_app_customer);
if(!empty($params['search']['name'])){
$this->db->like('name',$params['search']['name']);
}
$this->db->order_by('dom','DESC');
//set start and limit
if(array_key_exists("start",$params) && array_key_exists("limit",$params)) {
$this->db->limit($params['limit'],$params['start']);
} elseif(!array_key_exists("start",$params) && array_key_exists("limit",$params)) {
$this->db->limit($params['limit']);
}
return $this->db->get()->result();
}
public function customerSave($data_array, $id = 0)
{
if($id == 0) {
$this->db->insert($this->table_app_customer,$data_array);
$last_id = $this->db->insert_id();
} else {
$this->db->where('id', $id);
$this->db->update($this->table_app_customer,$data_array);
$last_id = $id;
}
return $last_id;
}
public function getCustomerData($customer_id)
{
$this->db->select('*');
$this->db->where('id', $customer_id);
$this->db->limit(1);
return $this->db->get($this->table_app_customer)->row();
}
public function getAllCustomerData()
{
$this->db->select('*');
$this->db->order_by('dom','DESC');
return $this->db->get($this->table_app_customer)->result();
}
public function getAllWaiterData()
{
$this->db->select('*');
$this->db->where('user_role_id',4);
$this->db->order_by('dom','DESC');
return $this->db->get($this->table_app_users)->result();
}
}