title: How to update a column of a field in Laravel 4?
body: <p>I'm trying to call an AJAX request on a route that calls this function updateImpression() in UserController, and this function tries to increment the counter column named "impressions_cpunt" in my 'users' table stored in MySQL. I tried using Eloquent to update the column of one particular user only.</p>
  
  <pre><code>public function updateImpression()
  {
      $username = Input::get('username');
      $user = User::where('username', '=', $username)-&gt;first();
      $impressions_count = $user-&gt;impressions_count + 1;
  
      // save() method failed to update my database.
      // $user-&gt;impressions_count = $impressions_count;
      // $user-&gt;save();
  
      //update() method does not return anything. Any syntax error here?
      //$user-&gt;update(array('impressions_count' =&gt; $impressions_count));
  
      DB::table('users')
          -&gt;where('username', $username)
          -&gt;update(array('impressions_count' =&gt; $impressions_count));
  
      $user = User::where('username', '=', $username)-&gt;first();
  
      return $user-&gt;impressions_count;
  }
  </code></pre>
  
  <p>I think save() function should be work at the first place but my database doesn't get updated and return the original count, and the update() function doesn't even returning any value from the function. This only works when I use DB but I think Eloquent should be better to use since this is Laravel. Is there anything I missed or something wrong with the syntax? I know increments() data type should be used but please allow me to solve this before I change anything.</p>
  
  <p><strong>Update:</strong>
  This is my database queries shown in Debugbar when I use save() method:</p>
  
  <pre><code>select * from 'users' where 'username'= &lt;test&gt; limit 1
  select count(*) as aggregate from 'users' where 'username'= &lt;test&gt;
  select count(*) as aggregate from 'users' where 'email'= &lt;test@example.org&gt;
  </code></pre>