mardi 23 mars 2021

How can put the data into an array in laravel blade javascript?

In my laravel 5.3 project I have this in my controller for competitions table:

public function list(){
$data=Competition::all();
return view('map', ['data'=> $data]);
}

This is acceptable i my map.blade.php for five columns data as:

<ul>
@foreach ($data As $i)
    
@endforeach
</ul>

like this:

1 Fälttävlan Landskrona 55.87 12.83 2 Fälttävlan Sundsvall 62.39 17.31

In my script area for the map I want to make an array containing these for creating markers on the map. How do I do that? The $data contains everything in the DB table as not only data but column names and so on.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire