copy dari repo om Irfan
This commit is contained in:
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
class ModelKota 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_Kota($id = null) {
|
||||
if ($id === null) {
|
||||
$this->db->select('*');
|
||||
$this->db->from('kota');
|
||||
$this->db->order_by('NAMA_KOTA ASC');
|
||||
}else{
|
||||
$this->db->select('*');
|
||||
$this->db->from('kota ');
|
||||
$this->db->order_by('NAMA_KOTA ASC');
|
||||
$this->db->where(['ID_KOTA' => $id]);
|
||||
}
|
||||
return $this->db->get()->result_array();
|
||||
}
|
||||
|
||||
public function getData_Supplier_byKOTA($id) {
|
||||
$this->db->select('*');
|
||||
$this->db->from('supplier a');
|
||||
$this->db->join('kota b','b.ID_KOTA=a.KOTA_ID');
|
||||
$this->db->where(['a.KOTA_ID' => $id]);
|
||||
return $this->db->get()->result_array();
|
||||
}
|
||||
|
||||
public function getData_Pelanggan_byKOTA($id) {
|
||||
$this->db->select('*');
|
||||
$this->db->from('pelanggan a');
|
||||
$this->db->join('kota b','b.ID_KOTA=a.KOTA_ID');
|
||||
$this->db->where(['a.KOTA_ID' => $id]);
|
||||
return $this->db->get()->result_array();
|
||||
}
|
||||
|
||||
public function getData_Pihakke3_byKOTA($id) {
|
||||
$this->db->select('*');
|
||||
$this->db->from('pihakke3 a');
|
||||
$this->db->join('kota b','b.ID_KOTA=a.KOTA_ID');
|
||||
$this->db->where(['a.KOTA_ID' => $id]);
|
||||
return $this->db->get()->result_array();
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user