fix(model): prevent overwriting primary key on save
This commit is contained in:
@@ -517,7 +517,7 @@ class Model
|
|||||||
static::query($sql);
|
static::query($sql);
|
||||||
|
|
||||||
$pk = static::$dbPrimaryKey;
|
$pk = static::$dbPrimaryKey;
|
||||||
$this->$pk = $db->lastInsertId();
|
$this->$pk ??= $db->lastInsertId();
|
||||||
$this->markAsSaved();
|
$this->markAsSaved();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user