Skip to content

Commit

Permalink
Merge pull request #74 from aulrich/laravel-5.4-relation-position-fix
Browse files Browse the repository at this point in the history
Pivot Position Sorting
  • Loading branch information
weotch committed Aug 11, 2017
2 parents 0c3ee07 + 8726816 commit c93a073
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 c93a073

Please sign in to comment.