Laravel firstOrNew overwriting all entries
<p>I'm having problems with the firstOrNew() method. Please see my method below.</p>

<pre><code>public function updateUnique($attributeId, $data)
{
    $attribute = \App\Clients\Attribute::firstOrNew(
        [
        'mem_id' =&gt; $data-&gt;lead_id, 
        'attribute_id' =&gt; $attributeId, 
        'type' =&gt; $this-&gt;updateType($data-&gt;pk)
        ] );

    $attribute-&gt;mem_id = $data-&gt;lead_id;
    $attribute-&gt;type = $this-&gt;updateType($data-&gt;pk);
    $attribute-&gt;attribute_id = $attributeId;
    $attribute-&gt;attribute = $data-&gt;value;

    $attribute-&gt;save();
}
</code></pre>

<p>This worked absolutely fine until I added the property <code>public $primaryKey = "mem_id";</code> on the model Attribute.</p>

<p>All entries in the database are updated if "first". The 'new' aspect works ok.</p>

<p>As soon as I remove that it works. I'd like to try and understand what's going on?</p>