Posts Tagged "eloquent"


Ramblings of yet another developer!
  • Laravel Bug: Eloquent firstOrCreate() Broken With $casts Model Attribute

    Posted on Nov 09, 2017

    There's a bug with Eloquent's firstOrCreate() function where it doesn't work with the $casts attribute on the model; it will always either insert a new instance into the database or give a MySQL duplicate entry error.

  • Booting Eloquent Model Traits

    Posted on Jun 02, 2015

    So I've learnt a little Laravel/Eloquent trick today that is very much under-documented. Save for a casual mention in the Laravel documentation. Click to read more!