Accessing Object Properties...

Posted 11 months ago by devonian

Hi all, I'm trying to implement geocoding into my application. Having a hard time accessing the properties of the object. Please see below:

Package -> https://github.com/geocoder-php/GeocoderLaravel

My code ->

Route::get('geocode', function(){
    $geo = app('geocoder')->geocode('London, UK')->get();
    dd($geo->first()->getCoordinates()->latitude);
  });

Problem -> Cannot access private property Geocoder\Model\Coordinates::$latitude

Feel silly asking this, but how the hell do I access the latitude/longitude??

Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.