diff --git a/src/Illuminate/Database/Eloquent/Model.php b/src/Illuminate/Database/Eloquent/Model.php index d1f019b39f4c..ef5e1faabc99 100644 --- a/src/Illuminate/Database/Eloquent/Model.php +++ b/src/Illuminate/Database/Eloquent/Model.php @@ -1276,6 +1276,10 @@ protected function getKeyForSaveQuery() */ protected function performInsert(Builder $query) { + if ($this->usesUniqueIds()) { + $this->setUniqueIds(); + } + if ($this->fireModelEvent('creating') === false) { return false; } @@ -1287,10 +1291,6 @@ protected function performInsert(Builder $query) $this->updateTimestamps(); } - if ($this->usesUniqueIds()) { - $this->setUniqueIds(); - } - // If the model has an incrementing key, we can use the "insertGetId" method on // the query builder, which will give us back the final inserted ID for this // table from the database. Not all tables have to be incrementing though.