57 lines
1.2 KiB
PHP
57 lines
1.2 KiB
PHP
<?php
|
|
defined('BASEPATH') OR exit('No direct script access allowed');
|
|
|
|
class ModelAlamat extends CI_Model{
|
|
|
|
public function __construct()
|
|
{
|
|
parent::__construct();
|
|
//Codeigniter : Write Less Do More
|
|
}
|
|
|
|
public function get_data($id_user){
|
|
return $this->db
|
|
->where("data_user_iddata_user",$id_user)
|
|
->get("alamat_user")->result();
|
|
}
|
|
|
|
public function get_data_edit($id){
|
|
return $this->db
|
|
->where("idalamat_user",$id)
|
|
->get("alamat_user")->row();
|
|
}
|
|
|
|
public function get_Provinsi($index=0, $end=0)
|
|
{
|
|
if ($index > 0) {
|
|
$this->db->limit($index, $end);
|
|
}
|
|
return $this->db->get("provinces");
|
|
}
|
|
|
|
public function get_Kabupaten($id_provinsi)
|
|
{
|
|
$this->db->where("province_id", $id_provinsi);
|
|
return $this->db->get("regencie");
|
|
}
|
|
|
|
public function get_Kecamatan($id_kabupaten="")
|
|
{
|
|
$this->db->where("regency_id", $id_kabupaten);
|
|
return $this->db->get("districts");
|
|
}
|
|
|
|
public function getNamaProvinsi($id)
|
|
{
|
|
$this->db->where("id",$id);
|
|
return $this->db->get("provinces")->row_array()['name'];
|
|
}
|
|
public function getNamaKabupaten($id)
|
|
{
|
|
$this->db->where("id",$id);
|
|
return $this->db->get("regencie")->row_array()['name'];
|
|
}
|
|
|
|
|
|
}
|