diff --git a/src/Database/Barry/Model.php b/src/Database/Barry/Model.php index e26aa4cd..97afac72 100644 --- a/src/Database/Barry/Model.php +++ b/src/Database/Barry/Model.php @@ -504,7 +504,7 @@ private function writeRows(Builder $builder) $primary_key_value = static::$builder->getPdo()->lastInsertId(); } - if (is_null($primary_key_value)) { + if (is_null($primary_key_value) || $primary_key_value == 0) { $primary_key_value = $this->attributes[$this->primary_key] ?? null; }