| @@ 105-123 (lines=19) @@ | ||
| 102 | * |
|
| 103 | * @return \Illuminate\Http\Response |
|
| 104 | */ |
|
| 105 | public function allCityByProvince($id) |
|
| 106 | { |
|
| 107 | $cities = $this->indonesia->findProvince($id, ['cities']); |
|
| 108 | ||
| 109 | if (isset($cities->cities)) { |
|
| 110 | $cities = $cities->cities; |
|
| 111 | } else { |
|
| 112 | $cities = $this->city->getAttributes(); |
|
| 113 | } |
|
| 114 | ||
| 115 | foreach($cities as $city){ |
|
| 116 | array_set($city, 'label', $city->name); |
|
| 117 | } |
|
| 118 | ||
| 119 | $response['city'] = $cities; |
|
| 120 | $response['status'] = true; |
|
| 121 | ||
| 122 | return response()->json($response); |
|
| 123 | } |
|
| 124 | ||
| 125 | /** |
|
| 126 | * Display a listing of the city resource. |
|
| @@ 166-184 (lines=19) @@ | ||
| 163 | * |
|
| 164 | * @return \Illuminate\Http\Response |
|
| 165 | */ |
|
| 166 | public function allDistrictByCity($id) |
|
| 167 | { |
|
| 168 | $districts = $this->indonesia->findCity($id, ['districts']); |
|
| 169 | ||
| 170 | if (isset($districts->districts)) { |
|
| 171 | $districts = $districts->districts; |
|
| 172 | } else { |
|
| 173 | $districts = $this->district->getAttributes(); |
|
| 174 | } |
|
| 175 | ||
| 176 | foreach($districts as $district){ |
|
| 177 | array_set($district, 'label', $district->name); |
|
| 178 | } |
|
| 179 | ||
| 180 | $response['district'] = $districts; |
|
| 181 | $response['status'] = true; |
|
| 182 | ||
| 183 | return response()->json($response); |
|
| 184 | } |
|
| 185 | ||
| 186 | /** |
|
| 187 | * Display a listing of the district resource. |
|
| @@ 227-245 (lines=19) @@ | ||
| 224 | * |
|
| 225 | * @return \Illuminate\Http\Response |
|
| 226 | */ |
|
| 227 | public function allVillageByDistrict($id) |
|
| 228 | { |
|
| 229 | $villages = $this->indonesia->findDistrict($id, ['villages']); |
|
| 230 | ||
| 231 | if (isset($villages->villages)) { |
|
| 232 | $villages = $villages->villages; |
|
| 233 | } else { |
|
| 234 | $villages = $this->village->getAttributes(); |
|
| 235 | } |
|
| 236 | ||
| 237 | foreach($villages as $village){ |
|
| 238 | array_set($village, 'label', $village->name); |
|
| 239 | } |
|
| 240 | ||
| 241 | $response['village'] = $villages; |
|
| 242 | $response['status'] = true; |
|
| 243 | ||
| 244 | return response()->json($response); |
|
| 245 | } |
|
| 246 | ||
| 247 | /** |
|
| 248 | * Display a listing of the village resource. |
|