Skip to content

Commit

Permalink
Add morph type to attributes when making new pivot.
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonlewis committed Mar 18, 2021
1 parent 9c9f858 commit 66ad9cd
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/Illuminate/Database/Eloquent/Relations/MorphToMany.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,8 @@ public function newPivot(array $attributes = [], $exists = false)
{
$using = $this->using;

$attributes = Arr::add($attributes, $this->morphType, $this->morphClass);

$pivot = $using ? $using::fromRawAttributes($this->parent, $attributes, $this->table, $exists)
: MorphPivot::fromAttributes($this->parent, $attributes, $this->table, $exists);

Expand Down

0 comments on commit 66ad9cd

Please sign in to comment.