Skip to content

Commit

Permalink
fix MorphToMany test
Browse files Browse the repository at this point in the history
  • Loading branch information
alberto-bottarini committed Feb 12, 2017
1 parent 81053b4 commit b900c41
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/Illuminate/Database/Eloquent/Relations/MorphToMany.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ class MorphToMany extends BelongsToMany
* @param bool $inverse
* @return void
*/
public function __construct(Builder $query, Model $parent, $name, $table, $foreignKey, $relatedKey, $relationName = null, $inverse = false)
public function __construct(Builder $query, Model $parent, $name, $table, $foreignKey, $relatedKey, $localKey, $relationName = null, $inverse = false)
{
$this->inverse = $inverse;
$this->morphType = $name.'_type';
$this->morphClass = $inverse ? $query->getModel()->getMorphClass() : $parent->getMorphClass();

parent::__construct($query, $parent, $table, $foreignKey, $relatedKey, $relationName);
parent::__construct($query, $parent, $table, $foreignKey, $relatedKey, $localKey, $relationName);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions tests/Database/DatabaseEloquentMorphToManyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public function getRelation()
{
list($builder, $parent) = $this->getRelationArguments();

return new MorphToMany($builder, $parent, 'taggable', 'taggables', 'taggable_id', 'tag_id');
return new MorphToMany($builder, $parent, 'taggable', 'taggables', 'taggable_id', 'tag_id', 'id');
}

public function getRelationArguments()
Expand All @@ -98,7 +98,7 @@ public function getRelationArguments()
$builder->shouldReceive('where')->once()->with('taggables.taggable_id', '=', 1);
$builder->shouldReceive('where')->once()->with('taggables.taggable_type', get_class($parent));

return [$builder, $parent, 'taggable', 'taggables', 'taggable_id', 'tag_id', 'relation_name', false];
return [$builder, $parent, 'taggable', 'taggables', 'taggable_id', 'tag_id', 'id', 'relation_name', false];
}
}

Expand Down

0 comments on commit b900c41

Please sign in to comment.