diff --git a/src/Illuminate/Database/Eloquent/Relations/MorphToMany.php b/src/Illuminate/Database/Eloquent/Relations/MorphToMany.php index e1660eda00c4..0976ab6ac35d 100644 --- a/src/Illuminate/Database/Eloquent/Relations/MorphToMany.php +++ b/src/Illuminate/Database/Eloquent/Relations/MorphToMany.php @@ -128,7 +128,10 @@ protected function newPivotQuery() */ public function newPivot(array $attributes = [], $exists = false) { - $pivot = new MorphPivot($this->parent, $attributes, $this->table, $exists); + $using = $this->using; + + $pivot = $using ? new $using($this->parent, $attributes, $this->table, $exists) + : new MorphPivot($this->parent, $attributes, $this->table, $exists); $pivot->setPivotKeys($this->foreignKey, $this->relatedKey) ->setMorphType($this->morphType)