October 22, 2024
Chicago 12, Melborne City, USA
jQuery

How to manage JavaScript redundancy in Laravel


I have some common JavaScript functions in my Blade views. What is the best practice in Laravel to reduce redundancy and store these functions in one place? Storing them in app.js and accessing them doesn’t seem to work.

For example, I have some JavaScript code inside the tag in the admin.view, and the same code is in the index.view. So, when I make a change in the admin.view, I also have to update the index.view. I’m a newbie, so please be kind and explain the best way to do this in Laravel. A code example would be really helpful



You need to sign in to view this answers

Leave feedback about this

  • Quality
  • Price
  • Service

PROS

+
Add Field

CONS

+
Add Field
Choose Image
Choose Video