65 lines
1.5 KiB
PHP
65 lines
1.5 KiB
PHP
<?php namespace App\Models;
|
|
|
|
use CodeIgniter\Model;
|
|
|
|
class Dashboard_model extends Model
|
|
{
|
|
|
|
|
|
public function getLoggedInUserData($id)
|
|
{
|
|
$builder = $this->db->table('user_management');
|
|
$builder->where('id',$id);
|
|
$result = $builder->get();
|
|
if(count($result->getResultArray()) ==1)
|
|
{
|
|
return $result->getRow();
|
|
}else{
|
|
return false;
|
|
}
|
|
|
|
}
|
|
|
|
function fetch_country()
|
|
{
|
|
|
|
$builder = $this->db->table('country');
|
|
$query = $builder->get();
|
|
//print_r($query);die();
|
|
$output = '<option value="">Select Country</option>';
|
|
foreach($query->getResult() as $row)
|
|
{
|
|
$output .= '<option value="'.$row->country_id.'">'.$row->country_name.'</option>';
|
|
}
|
|
return $output;
|
|
}
|
|
function fetch_state($country_id)
|
|
{
|
|
|
|
$builder = $this->db->table('state');
|
|
$builder->where('country_id',$country_id);
|
|
$query = $builder->get();
|
|
//print_r($query);die();
|
|
$output = '<option value="">Select State</option>';
|
|
foreach($query->getResult() as $row)
|
|
{
|
|
$output .= '<option value="'.$row->state_id.'">'.$row->state_name.'</option>';
|
|
}
|
|
return $output;
|
|
}
|
|
function fetch_city($state_id)
|
|
{
|
|
|
|
$builder = $this->db->table('city');
|
|
$builder->where('state_id',$state_id);
|
|
$query = $builder->get();
|
|
//print_r($query);die();
|
|
$output = '<option value="">Select city</option>';
|
|
foreach($query->getResult() as $row)
|
|
{
|
|
$output .= '<option value="'.$row->city_id.'">'.$row->city_name.'</option>';
|
|
}
|
|
return $output;
|
|
}
|
|
|
|
} |