Last active
January 8, 2019 16:04
-
-
Save thesubhendu/3c052f28c9688498a4093220b88e62a5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
public function geoCodeLatLng($lat, $lng) | |
{ | |
$googleGeocodeApiUrl= | |
"https://maps.googleapis.com/maps/api/geocode/json?latlng=$lat,$lng&key=".config('googlemapjs.key'); | |
$response = json_decode(file_get_contents($googleGeocodeApiUrl)); | |
if (!$response) { | |
throw new \Exception('Could not geocode'); | |
} | |
$geoCodedResult=$response->results[0]; | |
$this->cacheGeoCodedResult($geoCodedResult); | |
return $response->results[0]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment