From 1676f73cd9418522645e176bf3128cf1ee7d2f25 Mon Sep 17 00:00:00 2001 From: Franck DAKIA Date: Fri, 27 Oct 2023 23:10:48 +0000 Subject: [PATCH] Update Model.php --- src/Database/Barry/Model.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; }