Skip to content

Commit

Permalink
修复关联对象动态设置表后缀之后写入数据时不自动添加数据表后缀的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
axguowen authored and liu21st committed Jun 25, 2024
1 parent 58633b8 commit 89d0aed
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/model/relation/HasMany.php
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ public function make($data = []): Model
// 保存关联表数据
$data[$this->foreignKey] = $this->parent->{$this->localKey};

return new $this->model($data);
return (new $this->model($data))->setSuffix($this->getModel()->getSuffix());
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/model/relation/MorphMany.php
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ public function make($data = []): Model
$data[$this->morphKey] = $this->parent->$pk;
$data[$this->morphType] = $this->type;

return new $this->model($data);
return (new $this->model($data))->setSuffix($this->getModel()->getSuffix());
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/model/relation/MorphOne.php
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ public function make($data = []): Model
$data[$this->morphKey] = $this->parent->$pk;
$data[$this->morphType] = $this->type;

return new $this->model($data);
return (new $this->model($data))->setSuffix($this->getModel()->getSuffix());
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/model/relation/OneToOne.php
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ public function make($data = []): Model
// 保存关联表数据
$data[$this->foreignKey] = $this->parent->{$this->localKey};

return new $this->model($data);
return (new $this->model($data))->setSuffix($this->getModel()->getSuffix());
}

/**
Expand Down

0 comments on commit 89d0aed

Please sign in to comment.