I need to get latitude and longitude from this array:
AddressCollection {#237 ▼
-addresses: array:1 [▼
0 => Address {#232 ▼
-coordinates: Coordinates {#233 ▼
-latitude: 55.923431
-longitude: 23.3490609
}
-bounds: Bounds {#234 ▶}
-streetNumber: "18"
-streetName: "Vilniaus gatvÄ—"
-subLocality: null
-locality: "Ĺ iauliai"
-postalCode: "76258"
-adminLevels: AdminLevelCollection {#235 ▶}
-country: Country {#236 ▶}
-timezone: null
}
]
}
Code in my controller:
$posts = Post::latest()->get();
Mapper::location('Lietuva')->map(['zoom' => 7, 'scrollWheelZoom'=>false, 'marker'=>false]); //A map is displayed in the index page
foreach($posts as $post){
$city = $post->city;
$address = $post->address;
$mark = app('geocoder')->geocode($city . $address)->get();
dd($mark);
//
//THIS IS WHERE I NEED THOSE COODINATES
//
//For example $lat = $mark->coordinates.......
//Mapper::marker($lat, $long); Make a marker for every address in the DB
}
return view('posts.index', compact('posts'));
Not sure if this will generate markers for my map, but i still have no idea how to get specific information from JSON array. Thank you in advance
via Dziubutkus