diff --git a/src/Libs/Model.php b/src/Libs/Model.php index e3f43a8..92a225d 100644 --- a/src/Libs/Model.php +++ b/src/Libs/Model.php @@ -517,7 +517,7 @@ class Model static::query($sql); $pk = static::$dbPrimaryKey; - $this->$pk = $db->lastInsertId(); + $this->$pk ??= $db->lastInsertId(); $this->markAsSaved(); }