0
How I can style an object into one array
in the controller
Laravel?
Mapper::marker($marker['lat'],
$marker['lng'],['label'=> "<div>".$marker['label']."</div>"]);
Controller
public function index(){
Mapper::map(-22.886449, -43.118474,
[ 'marker'=>false,
'zoom' => 10,
'draggable' => true,
'center' => true,
'cluster' => false,
'markers' => [
'eventBeforeLoad' => 'addMapStyling(map);',
'icon' =>'img/ida_22.png',
'title' => '166001',
'animation' => 'DROP'],
]);
$markers = array(['lat' => -22.886449,'lng' => -43.118474,'label'=> 'Veículo 01'],
['lat' => -22.885632,'lng' => -43.118143,'label'=> 'Veículo 02'],
['lat' => -22.883990,'lng' => -43.119513,'label'=> 'Veículo 03'],
['lat' => -22.885734,'lng' => -43.124988,'label'=> 'Veículo 04']);
foreach ($markers as $marker) {
//dd($marker['label']);
Mapper::marker($marker['lat'], $marker['lng'],
['label'=> $marker['label']]);
Mapper::informationWindow($marker['lat'], $marker['lng'], $marker['label']);
}
return view('rastreamento.mapa.mapa');
}
View
<div id="#map-canvas-0">
{!! Mapper::render() !!}
</div>
The package name and cornford googlmapper
I need it to stay that way:
You configure the style in the View and Controller only send data!? got it
– novic
I am using that package of cornford google mapper, which facilitates integration with google map, put all the logic in the controller, in the view there is only one variable rendered and the controller is like the example below: foreach ($markers as $Marker) { Mapper::Marker($Marker['lat'], $Marker['lng'],['label'=> $Marker['label']]); Mapper::informationWindow($Marker['lat'], $Marker['lng'], $Marker['label']); }
– Carlos Alexandre R Ramos
Put the package name, put all the code, put an example of how it looks and how you want it to look like ... !!! is little information.
– novic