title: How can I use laravel db query ->update() method in if statement
body: <p>I want to check something in if, and if that condition is true I want to update the record that was fetched before.</p>
  
  <pre><code>$resultQuery = DB::table('cards')-&gt;where('api_id', $card-&gt;id)-&gt;first();
  
  if (this condition will pass I want to update this record) {
      $resultQuery-&gt;update(array('price_usd' =&gt; $card-&gt;prices-&gt;usd));
  }
  </code></pre>
  
  <p>When I use the ->update() like this, I get an error:</p>
  
  <blockquote>
    <p>Call to undefined method stdClass::update();</p>
  </blockquote>
  
  <p>How can I do this ?</p>