Skip to content
Advertisement

Laravel with google map is not showing markers from lattitude and longitude values in databse

I am trying to show markers on Google map from already stored values (lattitude and longitude) in mysql databse. but when i try to load it markers are not showing in google map. Am new to laravel. please help me to implement it.

Following is the code in view page

JavaScript

I will get latitude and longitude values by <?php echo $loc->lat ?> & <?php echo $loc->long ?> in this same page but i dont know how to pass it, please help me

Advertisement

Answer

Since your script is inside the Laravel blade, you can assign PHP variable longitude and latitude to a javascript variable.

JavaScript

Now you can use provided_longitude and provided_latitude into google map.

Iframe Example inside the example.blade.php

JavaScript

EDIT 1

To show the markers from the table (eg: orders having column longitude, latitude)

//Inside Your Controller

JavaScript

//Inside your/page.blade.php

JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement