Skip to content

Commit

Permalink
add getMorphType
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Mar 18, 2021
1 parent 66ad9cd commit 7e08215
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
10 changes: 10 additions & 0 deletions src/Illuminate/Database/Eloquent/Relations/MorphPivot.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,16 @@ public function delete()
});
}

/**
* Get the morph type for the pivot.
*
* @return string
*/
public function getMorphType()
{
return $this->morphType;
}

/**
* Set the morph type for the pivot.
*
Expand Down
2 changes: 0 additions & 2 deletions src/Illuminate/Database/Eloquent/Relations/MorphToMany.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,6 @@ 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 7e08215

Please sign in to comment.