How to take out view function dynamic js in a separate file?

In templates it is not recommended to use inline js. But what about js which take data model objects, for example I walk around in the collection foreach'ω to display the data in charts chart.js

For example:
datasets: [
 @foreach ($demandArray as $keyword => $values)
{
 label: '{{$keyword}}',
 data: [@foreach($values as $key => $value) {{$value}} @endforeach],
 fill: false,
 borderColor: colors.pop()
},
 @endforeach


Vyuha is large and there are many kinds of charts (pie, bar, etc.), the result is a lot of inserts an inline script that is cluttering up code.

Is it possible to move all js logic in a separate file to also foreach'om there it all goes, and then compiled into a single js file?
March 12th 20 at 08:12
0 answer

Find more questions by tags Laravel