title: Versioning with Laravel / Eloquent
body: <p>I have a products table that has an serial id, a sku, an is_current flag, and then various attributes about the item.  It also has a unique index on sku where is_current = true to prevent having more than one current record.</p>
  <p>What I want to happen is, when you change the model and call save(), a new record is created instead and the existing record is only changed to flip the is_current flag.  So what I think I want is a way to copy the model with replicate(), discard the changes in the old model and just update to flip the current flag false, and then insert the new model.  Something like that, although I might not have thought that though 100%.  Can this be done in as a part of an &quot;updating&quot; event?  Is a trigger a better choice to prevent accidents if some direct table updates occur?</p>