Skip to content

Commit

Permalink
改进自动写入
Browse files Browse the repository at this point in the history
  • Loading branch information
liu21st committed Sep 5, 2024
1 parent a24876f commit d5c987e
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -781,9 +781,14 @@ protected function insertData(string $sequence = null): bool

// 自动(使用修改器)写入字段
if (!empty($this->insert)) {
foreach ($this->insert as $field) {
foreach ($this->insert as $name => $val) {
$field = is_string($name) ? $name : $val;
if (!isset($this->data[$field])) {
$this->setAttr($field, null);
if (is_string($name)) {
$this->data[$name] = $val;
} else {
$this->setAttr($field, null);
}
}
}
}
Expand Down

0 comments on commit d5c987e

Please sign in to comment.