App\Http\Controllers\ExampleController::getGeocoding PHP Method

getGeocoding() public method

* |-------------------------------------------------------------------------- | Example Controller |-------------------------------------------------------------------------- | | This controller illustrate how to make Google Maps API Web Service | calls using this package | | Place this file within your controllers app/Http/Controllers | In the routes.php file add Route::controller('example', 'TestController'); | Make request by accessing each method in web browser: | http://test.net/example/geocoding | http://test.net/example/directions |
public getGeocoding ( )
    public function getGeocoding()
    {
        /**
         * Usin Place Id
         */
        $d['a'] = \GoogleMaps::load('geocoding')->setParamByKey('place_id', 'ChIJd8BlQ2BZwokRAFUEcm_qrcA')->get();
        /**
         * Reverse geocoding with components parameters
         */
        $d['b'] = \GoogleMaps::load('geocoding') > setParamByKey('latlng', '40.714224,-73.961452')->setParamByKey('components.administrative_area', 'TX')->setParamByKey('components.country', 'US')->get();
        /**
         * Setting all parameters at once and retrieve locations parameters from response 
         */
        $d['c'] = \GoogleMaps::load('geocoding')->setParam(['address' => 'santa cruz', 'components' => ['administrative_area' => 'TX', 'country' => 'US']])->getResponseByKey('results.geometry.location');
        dd($d);
    }