fix getcities by parent
This commit is contained in:
parent
8767b823ca
commit
72002bd437
@ -37,7 +37,8 @@ class AreaGeo extends BaseController {
|
||||
}
|
||||
|
||||
public function getCities() {
|
||||
$rows = $this->model->getCities();
|
||||
$filter = [ 'Parent' => $this->request->getVar('Parent') ?? null ];
|
||||
$rows = $this->model->getCities($filter);
|
||||
|
||||
if (empty($rows)) { return $this->respond([ 'status' => 'success', 'message' => "data not found", 'data' => [] ], 200); }
|
||||
return $this->respond([ 'status' => 'success', 'message'=> "Data fetched successfully", 'data' => $rows ], 200);
|
||||
|
||||
@ -29,8 +29,11 @@ class AreaGeoModel extends BaseModel {
|
||||
return $rows;
|
||||
}
|
||||
|
||||
public function getCities() {
|
||||
public function getCities($filter) {
|
||||
$this->select('AreaGeoID, AreaName')->where('Parent > 0');
|
||||
if(!empty($filter['Parent'])){
|
||||
$this->where('Parent', $filter['Parent']);
|
||||
}
|
||||
return $this->findAll();
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user