59 lines
1.3 KiB
PHP
59 lines
1.3 KiB
PHP
<?php namespace App\Models;
|
|
|
|
use CodeIgniter\Model;
|
|
|
|
class Common_model extends Model
|
|
{
|
|
|
|
|
|
function fetch_country()
|
|
{
|
|
|
|
$builder = $this->db->table('country');
|
|
$query = $builder->get();
|
|
//print_r($query->getResult());die();
|
|
$output = '<option value="">Select Country</option>';
|
|
foreach($query->getResult() as $row)
|
|
{
|
|
$output .= '<option value="'.$row->id.'">'.$row->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->id.'">'.$row->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->id.'">'.$row->name.'</option>';
|
|
}
|
|
return $output;
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
} |