62 lines
1.8 KiB
PHP
62 lines
1.8 KiB
PHP
<?php
|
|
defined('BASEPATH') OR exit('No direct script access allowed');
|
|
class ModelServiceCenter extends CI_Model {
|
|
public function create($table, $data, $batch = false)
|
|
{
|
|
if($batch === false){
|
|
$insert = $this->db->insert($table, $data);
|
|
}else{
|
|
$insert = $this->db->insert_batch($table, $data);
|
|
}
|
|
return $insert;
|
|
}
|
|
|
|
public function update($table, $data, $pk, $id = null, $batch = false)
|
|
{
|
|
if($batch === false){
|
|
$insert = $this->db->update($table, $data, array($pk => $id));
|
|
}else{
|
|
$insert = $this->db->update_batch($table, $data, $pk);
|
|
}
|
|
return $insert;
|
|
}
|
|
|
|
public function delete($table, $data, $pk)
|
|
{
|
|
$this->db->where_in($pk, $data);
|
|
return $this->db->delete($table);
|
|
}
|
|
|
|
public function getData_ServiceCenter($id = null){
|
|
if ($id === null) {
|
|
$this->db->select('*');
|
|
$this->db->from('servicecenter');
|
|
$this->db->order_by('NAMA_SERVICECENTER');
|
|
}else{
|
|
$this->db->select('*');
|
|
$this->db->from('servicecenter');
|
|
$this->db->where(['ID_SERVICECENTER' => $id]);
|
|
}
|
|
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_ServiceCenter_byNAMA($nama, $id=null){
|
|
$this->db->select('*');
|
|
$this->db->from('servicecenter');
|
|
$this->db->where(['NAMA_SERVICECENTER' => $nama]);
|
|
if ($id!=null) {
|
|
$this->db->where('ID_SERVICECENTER!=', $id);
|
|
}
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
public function getData_KlaimService_bySERVICECENTER($id){
|
|
$this->db->select('*');
|
|
$this->db->from('klaim_service');
|
|
$this->db->where(['SERVICECENTER_ID' => $id]);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
}
|
|
?>
|