Skip to content

Commit

Permalink
Merge pull request #27997 from staudenmeir/detach
Browse files Browse the repository at this point in the history
[5.8] Fix BelongsToMany::detach() with custom pivot class
  • Loading branch information
taylorotwell authored Mar 25, 2019
2 parents 9898c3d + 2efbb5b commit 747577b
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ protected function hasPivotColumn($column)
*/
public function detach($ids = null, $touch = true)
{
if ($this->using && ! empty($ids)) {
if ($this->using && ! empty($ids) && empty($this->pivotWheres) && empty($this->pivotWhereIns)) {
$results = $this->detachUsingCustomClass($ids);
} else {
$query = $this->newPivotQuery();
Expand Down

0 comments on commit 747577b

Please sign in to comment.