title: My query will not update, but when i refresh in dd it will
body: <p>When I run the query normally it won't update the <strong>status_order</strong> from <code>0</code> to <code>1</code>, but when I put a <strong>dd()</strong> function after the query to check if it will update properly, it will give the same result the first time I run the code, but when I refresh the page it will update to a <code>1</code>.</p>
  <p>Here's how my code usually looks:</p>
  <pre class="lang-php prettyprint-override"><code>public function payment(Request $request){
        $total = 0;
        $orderInfo = $this-&gt;getOrderInfo();
        $json2 = array();
          foreach($this-&gt;getOrderInfo()-&gt;products as $product){
            $total += ($product-&gt;price * $product-&gt;pivot-&gt;order_quantity);
          }
        if(Customer::find(Auth::user()-&gt;id)-&gt;balance &gt;= $total &amp;&amp; $orderInfo !== null){
          if($orderInfo-&gt;order_status !== 1){
          $orderInfo-&gt;where('customer_id', Auth::user()-&gt;id)
                    -&gt;where('order_status', 0)
                    -&gt;update(['order_status' =&gt; 1]);
        }
          foreach($orderInfo-&gt;products as $product){
            $json = array('order_id' =&gt; $product-&gt;pivot-&gt;order_id,
                          'product_id' =&gt; $product-&gt;pivot-&gt;product_id,
                          'product_name' =&gt; $product-&gt;name,
                          'price' =&gt; $product-&gt;price,
                          'quantity' =&gt; $product-&gt;pivot-&gt;order_quantity);
            array_push($json2, $json);
          }
          Customer::where('id', Auth::user()-&gt;id)-&gt;decrement('balance', $total);
          array_push($json2, array('order_status' =&gt; $orderInfo-&gt;order_status));
          $productInfo = json_encode($json2, JSON_PRETTY_PRINT);
          OrderHistory::create([
            'customer_id' =&gt; Auth::user()-&gt;id,
            'orderInfo' =&gt; $productInfo
          ]);
          $orderInfo-&gt;products()
          -&gt;detach();
          $orderInfo-&gt;delete();
          return back();
        }else{
          return &quot;Not enough balance&quot;;
        }
    }
  }
  </code></pre>
  <p>Here's where I put my <strong>dd()</strong> function:</p>
  <pre class="lang-php prettyprint-override"><code>  if($orderInfo-&gt;order_status !== 1){
          $orderInfo-&gt;where('customer_id', Auth::user()-&gt;id)
                    -&gt;where('order_status', 0)
                    -&gt;update(['order_status' =&gt; 1]);
            dd($orderInfo-&gt;where('customer_id', Auth::user()-&gt;id)-&gt;where('order_status', 0));
        }
  </code></pre>
  <p>The <code>if($orderInfo-&gt;order_status !== 1)</code> is put in there for me to check if the query would get skipped at all. I have tried to alter the order in which the code is presented, but it didn't make any difference.</p>