Skip to content

Commit

Permalink
getOtherKey was moved onto the Pivot Object in Laravel 5.4; by fetchi…
Browse files Browse the repository at this point in the history
…ng the first Result we can directly access it. (in the position class there should always be a ->first() element)
  • Loading branch information
arminulrich committed Aug 11, 2017
1 parent 0c3ee07 commit 8726816
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion classes/Input/Position.php
Expand Up @@ -25,7 +25,7 @@ public function __construct($item, $relationship = null)
if ($relationship && Request::has('parent_id')) {
$relation = $this->item->{$relationship}();
if ($relation instanceof BelongsToMany) {
$this->pivot = $relation->where($relation->getOtherKey(), '=', request('parent_id'))->first()->pivot;
$this->pivot = $relation->where($relation->first()->pivot->getOtherKey(), '=', request('parent_id'))->first()->pivot;
}
}
}
Expand Down

0 comments on commit 8726816

Please sign in to comment.