title: How to update a collection using Eloquent Laravel
body: <p>I have a one to many relationship between <code>Device</code> and <code>Command</code> models (each <code>Device</code> has many <code>commands</code>). Now I want to update a collection of commands using <code>save()</code> method. So, I used the following code:</p>
  
  <pre><code>$device = Device::find(1);
  $commands = $device-&gt;commands()-&gt;whereStatus("pending")-&gt;get();
  
  $commands-&gt;status = "sent";
  $commands-&gt;save();
  </code></pre>
  
  <p>But I got a <code>FatalErrorException</code> exception with an error message of <code>Call to undefined method Illuminate\Database\Eloquent\Collection::save()</code>.</p>
  
  <p>In other words, I am looking for an equivalent MySQL query of the following in the <code>Eloquent</code>:</p>
  
  <pre><code>UPDATE commands SET status = 'sent' WHERE status = 'pending';
  </code></pre>
  
  <p>using Laravel 4.2</p>