|
|
@@ -252,10 +252,20 @@ class Utils |
|
|
|
return $result; |
|
|
|
} |
|
|
|
|
|
|
|
public function getZipByCity($city) |
|
|
|
public function getZipByCity($city, $code = null) |
|
|
|
{ |
|
|
|
$zip = null ; |
|
|
|
$returnCitiesSearchZip = json_decode($this->callCitiesApi('get', 'communes', ['nom' => $city, 'fields' => 'nom,codesPostaux'])) ; |
|
|
|
|
|
|
|
$paramsSearch = [ |
|
|
|
'nom' => $city, |
|
|
|
'fields' => 'nom,codesPostaux' |
|
|
|
] ; |
|
|
|
|
|
|
|
if($code != null && $code != 0) { |
|
|
|
$paramsSearch['code'] = $code ; |
|
|
|
} |
|
|
|
|
|
|
|
$returnCitiesSearchZip = json_decode($this->callCitiesApi('get', 'communes', $paramsSearch)) ; |
|
|
|
|
|
|
|
if($returnCitiesSearchZip) { |
|
|
|
foreach($returnCitiesSearchZip as $citySearchZip) { |