Skip to content

Commit

Permalink
自动写入字段定义简化为使用insert属性
Browse files Browse the repository at this point in the history
  • Loading branch information
liu21st committed Sep 4, 2024
1 parent 1329ca9 commit a24876f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -780,8 +780,8 @@ protected function insertData(string $sequence = null): bool
}

// 自动(使用修改器)写入字段
if (!empty($this->autoInsertFields)) {
foreach ($this->autoInsertFields as $field) {
if (!empty($this->insert)) {
foreach ($this->insert as $field) {
if (!isset($this->data[$field])) {
$this->setAttr($field, null);
}
Expand Down
2 changes: 1 addition & 1 deletion src/model/concern/Attribute.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ trait Attribute
*
* @var array
*/
protected $autoInsertFields = [];
protected $insert = [];

/**
* 获取模型对象的主键.
Expand Down

0 comments on commit a24876f

Please sign in to comment.