Support the ongoing development of Laravel.io →
Views Blade Architecture
Last updated 2 years ago.
0

Maybe you could try to use a pure javascript implementation in your view using a prepared json string from your controller. Something like :

  • making an array with all your prepared data
  • give this array to your view
  • put the variable into a javascript object
  • iterate through this object and instantiate a marker

This way you could easily extract your javascript code into a plugin and reduce again the code in your view. Check that, I didn't test it but I'm sure you'll get the id.

Last updated 2 years ago.
0

You can also cut your code into partials.

Last updated 2 years ago.
0

Thanks, I've used your first code sample to come up with the following:

Controller: http://laravel.io/bin/6edXD View: http://laravel.io/bin/29ldE

Much cleaner!

Last updated 2 years ago.
0

Don't forget to tag as solved :)

Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.