i'm super new to Laravel and I've been doing some research on how to get the google maps api to work with laravel. I've already made my blade to fetch content from my database with eloquent etc, so I know that wwhen you use blade you can put the vars between two curly brackets to then "echo" them on the webpage (like this {{$training->Location}} )
The problem is that in the following snippet of code I need to pass the data from the Location table into a php var and I don't know how to pass it. That's how I did it , but obviously it didn't work out well , it just passes it as direct text I guess... So when I put this $adress = '{{$training->Location }}; and I echo it on my page for testing purposes I get this string as a result: %7B%7B%24training-%3ELocation%7D%7D which the googleMapsApi will not recognize as a correct adress.
Here's the code snippet: `
<div>
<H4>Location: {!!$training->Location!!}</H4>
</div>
<div>
<H4>Starting Date: {!!$training->DateTime!!} </H4>
</div>
<?php
$adress = '{{$training->Location}}';
//$adress = 'Universitätsring 1, 1010 Wien';
$adress = urlencode($adress);
$url = 'http://maps.googleapis.com/maps/api/geocode/xml?address=' . $adress . '&sensor=true';
$xml = simplexml_load_file($url);
$status = $xml->status;
if ($status == 'OK') {
$latitude = $xml->result->geometry->location->lat;
$longitude = $xml->result->geometry->location->lng;
} ?>`
I hope you understand my problem , sorry my English isn't the best, but if you don't understand I can always provide screenshots or a better explaination
$adress = $training->Location;