I'm passing some data from a controller in the index method:
public function index() { $variable = Modelo::orderBy('id', 'DESC')->get(); return view('vista', compact('variable')); }
and I am receiving them in this view:
<tbody> <tr v-for="value in values"> <td>@{{ value.id }}</td> <td>@{{ value.name }}</td> </tr> </tbody>
And the vue code is as follows:
new Vue({ el: '#app', data: { values: [] }, created: function() { this.getVaues() }, methods: { getValues: function() { var url= 'uri'; axios.get(url).then(response => { this.values = response.data }); } } });
The problem is that the data that is stored in the list "values" of the Vue code is a html mark, but if from the controller I only return the data (without the view) like this:
return Modelo::orderBy('id', 'DESC')->get();I confirm that evidently if it brings me the data of the BD, but I do not know how to see them.
This is what is stored in the "values" list of the Vue code and a JSON should be saved with the data obtained from the BD with the controller.