title: Vue changing variable value on receiveing data from backend Laravel
body: <p>i hope you are all doing ok.</p>
  <p>I have a weird problem that i just can't find a way to solve and the worst part I don't even know how to start looking for this problem over the internet.
  Here's the case:
  I make a DB request with the code below in Laravel:</p>
  <pre><code>public function previsao(){
      $dados = [];
      $tempoEntrega = 0;
      $tempoTroca = 0;
      $sugestaoCompra = 0;
      $frequencia = 0;
      $qnt = 0;
      $qntI = 0;
      $qntR = 0;
  
      $todosOsDados = $this-&gt;TecManutencaoEstoquePecaRegM
          -&gt;join('tec_manutencao_pecas', 'tec_manutencao_estoque_peca_regs.pecaId', 'tec_manutencao_pecas.id')
          -&gt;where('dataComp', '!=', null)
          -&gt;get();
  
      foreach ($todosOsDados as $todId) {
          $toIds[] = $todId-&gt;pecaId;
      }
  
      $idsUnicos = array_unique($toIds);
      foreach ($idsUnicos as $idu) {
          $ids[] = $idu;
      }
  
      foreach ($ids as $id) {
          $peca = $this-&gt;TecManutencaoPecasM
              -&gt;select('peca')
              -&gt;where('id', $id)
              -&gt;first();
  
          $entrega = $this-&gt;TecManutencaoEstoquePecaRegM
              -&gt;join('tec_manutencao_pecas', 'tec_manutencao_estoque_peca_regs.pecaId', 'tec_manutencao_pecas.id')
              -&gt;where('dataComp', '!=', null)
              -&gt;where('pecaId', $id)
              -&gt;where('mov', 'i')
              -&gt;select('data', 'dataComp', 'qnt', 'est_min')
              -&gt;get();
  
          foreach ($entrega as $e) {
              $tempoEntrega += (Carbon::parse($e-&gt;data)-&gt;diffInDays(Carbon::parse($e-&gt;dataComp)));
              $estMin = $e-&gt;est_min; 
              $qntI += $e-&gt;qnt; 
          }
  
          $qntRetirada = $this-&gt;TecManutencaoEstoquePecaRegM
              -&gt;join('tec_manutencao_pecas', 'tec_manutencao_estoque_peca_regs.pecaId', 'tec_manutencao_pecas.id')
              -&gt;where('dataComp', '!=', null)
              -&gt;where('pecaId', $id)
              -&gt;where('mov', 'r')
              -&gt;select('qnt')
              -&gt;get();
  
          foreach ($qntRetirada as $qr) {                    
              $qntR += $qr-&gt;qnt;
          }
  
          $qnt = $qntI - $qntR;
  
          $uso = $this-&gt;TecManutencaoEstoquePecaRegM
              -&gt;where('pecaId', $id)
              -&gt;where('mov', 'r')
              -&gt;select('data')
              -&gt;get();
  
          foreach ($uso as $u) {
              $ultimaEntrega = $this-&gt;TecManutencaoEstoquePecaRegM
                  -&gt;join('tec_manutencao_pecas', 'tec_manutencao_estoque_peca_regs.pecaId', 'tec_manutencao_pecas.id')
                  -&gt;where('pecaId', $id)
                  -&gt;where('mov', 'i')
                  -&gt;where('data', '&lt;=', $u-&gt;data)
                  -&gt;select('data')
                  -&gt;orderBy('data', 'DESC')
                  -&gt;first();
              
              $tempoTroca += (Carbon::parse($u-&gt;data)-&gt;diffInDays(Carbon::parse($ultimaEntrega-&gt;data)));
  
              $ultimaTroca = $u-&gt;data;
          }
  
          $frequencia = count($entrega);
  
          $sugestaoCompra = round(($tempoTroca * ($tempoEntrega + $frequencia)) - ($qnt - $estMin));
  
          $tempoTrocaMedio = count($uso) == 0 ? $tempoTroca : round($tempoTroca / count($uso));
  
          $tempoAteEstminAcabar = $qnt * $tempoTrocaMedio;
  
          $dataProxComp = $tempoAteEstminAcabar - round($tempoEntrega / count($entrega));
  
          $diasTroca = $tempoTroca &lt;= 0 ? round($tempoEntrega / count($entrega)) : $dataProxComp;
  
          $dados[] = [
              'id' =&gt; $id,
              'peca' =&gt; $peca-&gt;peca,
              'tempoEntrega' =&gt; $tempoEntrega &lt;= 0 ? $tempoEntrega : round($tempoEntrega / count($entrega)),
              'tempoTroca' =&gt; $tempoTroca &lt;= 0 ? $tempoTroca : round($tempoTroca / count($uso)),
              'qntProxComp' =&gt; $sugestaoCompra,
              //'dataProxComp' =&gt; date('d/m/Y', strtotime($ultimaTroca.'+'.$diasTroca.' days')),
              'dataProxComp' =&gt; $ultimaTroca == 0 || $ultimaTroca == null ? 
                  date('d/m/Y', strtotime($ultimaEntrega-&gt;data.'+'.$diasTroca.' days')) : 
                  date('d/m/Y', strtotime($ultimaTroca.'+'.$diasTroca.' days')),
              'qnt' =&gt; $qnt,
              'estMin' =&gt; $estMin
          ];
  
          $tempoEntrega = 0;
          $tempoTroca = 0;
          $sugestaoCompra = 0;
          $frequencia = 0;
          $qnt = 0;
          $qntI = 0;
          $qntR = 0;
      }
  
      //dd($dados);
  
      return $dados;     
  }
  </code></pre>
  <p>This code returns what I've expected:</p>
  <p><a href="https://i.stack.imgur.com/sZt6q.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/sZt6q.jpg" alt="Return from the backEnd" /></a></p>
  <p>Then a get this return with Vue like this:</p>
  <pre><code>methods: {
      getPredictions(){
          axios.get(this.rotagetprevisoes, this.dadosIniciais).then(res =&gt; {
              this.dadosIniciais = res.data
              console.log(res.data)
          })
      },
      rowClass(filtered, type){
          if (!filtered) return
          if (filtered.estMin &lt; filtered.qnt) return 'table-success'
          if (filtered.estMin = filtered.qnt) return 'table-warning'
          if (filtered.estMin &gt; filtered.qnt) return 'table-danger'
      },
      openRepModal(){
          this.$root.$emit('bv::show::modal', 'gerRelPrev', '#btnShow')
      },
      sugModal(item){
          if(item.qntProxComp &gt;= 0){
              this.qntSuges = item.qntProxComp
              this.acimaEstMin = 'n'
          } else {
              this.qntSuges = Math.abs(item.qntProxComp)
              this.acimaEstMin = 's'
          }
          this.dataSuges = item.dataProxComp
          this.$root.$emit('bv::show::modal', 'adminSugestao', '#btnShow')
      }
  },
  </code></pre>
  <p>But what I got here is:</p>
  <p><a href="https://i.stack.imgur.com/6RF0m.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/6RF0m.jpg" alt="Vue Console Log" /></a></p>
  <p>Note that the &quot;<em>estMin</em>&quot; has different values when is sent and when is received, the weirdest part is that it only goes from Laravel to Vue, nothing in the middle.
  I already try changing a lot of parts of my code, doing it all over again but, ended up with the same result, try searching for something related over the internet but no succeed.
  This field &quot;<em>estMin</em>&quot; is the only one affected and, it's not even a calculated field, it's only the data that I get from DB.
  I simply don't understand why &quot;<em>estMin</em>&quot; comes from Laravel with the values that I expect and arrive in Vue with a different value.
  One more thing, this is an array of objects, only pick one example to show you guys.
  Can someone help me please?</p>