lundi 29 octobre 2018

Creating a Google Map in Laravel,

I try to display Google Map which is display an address from database(I have address column in DB table). For this I made a blade, and bind to route and path it with controller. I am having display issue.

My step is right below. I used this google API.

https://github.com/farhanwazir/laravelgooglemaps

And set the route:

Route::get('/show', 'PagesController@map');

Set the controller:

public function map(){

    $config['center'] = allestates::where('address')->get();
    $config['zoom'] = '10';
    $config['map_width'] = '300px';
    $config['scrollwheel'] = false;

    GMaps::initialize($config);

    $map = GMaps::create_map();

    return view(pages.show)->with('map', $map);
}

And in my blade. This is how I am calling it in body tag.



But getting this error.

Undefined variable: map (View: /var/www/html/laravel/resources/views/pages/show.blade.php)

Any idea what the problem is?



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2Q3g82H
via IFTTT

Aucun commentaire:

Enregistrer un commentaire