Skip to content

Commit 7e08215

Browse files
committed
add getMorphType
1 parent 66ad9cd commit 7e08215

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,16 @@ public function delete()
7474
});
7575
}
7676

77+
/**
78+
* Get the morph type for the pivot.
79+
*
80+
* @return string
81+
*/
82+
public function getMorphType()
83+
{
84+
return $this->morphType;
85+
}
86+
7787
/**
7888
* Set the morph type for the pivot.
7989
*

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

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

154-
$attributes = Arr::add($attributes, $this->morphType, $this->morphClass);
155-
156154
$pivot = $using ? $using::fromRawAttributes($this->parent, $attributes, $this->table, $exists)
157155
: MorphPivot::fromAttributes($this->parent, $attributes, $this->table, $exists);
158156

0 commit comments

Comments
 (0)