Skip to content

Commit 66ad9cd

Browse files
committed
Add morph type to attributes when making new pivot.
1 parent 9c9f858 commit 66ad9cd

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/Illuminate/Database/Eloquent/Relations/MorphToMany.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,8 @@ public function newPivot(array $attributes = [], $exists = false)
151151
{
152152
$using = $this->using;
153153

154+
$attributes = Arr::add($attributes, $this->morphType, $this->morphClass);
155+
154156
$pivot = $using ? $using::fromRawAttributes($this->parent, $attributes, $this->table, $exists)
155157
: MorphPivot::fromAttributes($this->parent, $attributes, $this->table, $exists);
156158

0 commit comments

Comments
 (0)