insert a url/path into google maps marker, Laravel

Viewed 388

I am trying to insert a url/path into google map marker. So I tried google map's url: but no effects. when mouse on the marker it changes to pointer but I can't click or the page doesn't open.

By the way I try to make path to detail screen of each id.

var marker = new google.maps.Marker({
    map: map,
    icon: 'imgs/marker.png',
    label: {
         text: estates.data[0].price,
         color: "#fff",
    },
    url: "/pages/{{$est->id}}",
    position: {
         lat: {{$est->lat}},
         lng: {{$est->lng}}
    }
});

The way I am using it wrong?

Controller:

public function details($id)
    {
        $estates = allestates::where('id', $id)->first();

//        $rsltActualPrice = (int)$estates->extend / (int)$estates->price;

        return view('pages.details', compact('estates'));

    }

and Route:

Route::get('/pages/{id}', 'PagesController@details');
1 Answers

You may want to create a route like :

Route::get('/pages/{estateId}', 'yourController@index')->name('map');

and change your url address to this :

url: route('map', ['estateId' => $est->id]),
Related