I have the following account on my controller:
$todos_anos = $company->results()->distinct()->orderBy('ano', 'DESC')->select('ano')->get()->groupBy('ano');
If I do a dd(); I get exactly the expected result, which is my YEAR column with the data reversed.
Then I pass this variable to my vuejs component:
<ricentral :todos_anos="{{ $todos_anos }}"></ricentral>
and I loop through the data to display:
<option v-for="todo_ano in todos_anos" :value="todo_ano[0].ano">{{todo_ano[0].ano}}</option>
props: ['todos_anos'],
data () {
return {
todos_anos: this.todos_anos
}
},
however, it does not appear ordered, it ignores the order in which I passed the data. I've already tried using reverse() , but it doesn't work either. Why is this behavior occurring? If I'm passing the data in a certain order to Vuejs, why is it ignoring it?