title: Laravel Eloquent ORM save: update vs create
body: <p>I've got a table and I'm trying to use the <code>save()</code> method to update/create lines. The problem is that it always create new lines. The following code gives me about 12 lines each time I run it. They don't have a unique <code>id</code> before inserting them but the combination of <code>name</code> and <code>DateTimeCode</code> is unique. Is there's a way to use those two in order for laravel to recognize them as <code>exist()</code>? Should I consider using <code>if exist</code> with <code>create</code> and <code>update</code> instead?</p>
  
  <pre class="lang-php prettyprint-override"><code>foreach ($x as $y) {
      $model = new Model;
      $model-&gt;name = ''.$name[$x];
      $model-&gt;DateTimeCode = ''.$DateTimeCode[$x];
      $model-&gt;value = ''.$value[$x];
      $model-&gt;someothervalue = ''.$someothervalue[$x];
      $model-&gt;save();
  };
  </code></pre>