Skip to content

Commit

Permalink
tweak how detach and updateExistingPivot work with custom models
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Feb 26, 2019
1 parent 970c9ed commit cadea88
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -184,7 +184,7 @@ protected function attachNew(array $records, array $current, $touch = true)
*/
public function updateExistingPivot($id, array $attributes, $touch = true)
{
if ($this->using) {
if ($this->using && empty($this->pivotWheres) && empty($this->pivotWhereIns)) {
return $this->updateExistingPivotUsingCustomClass($id, $attributes, $touch);
}

@@ -403,7 +403,7 @@ protected function hasPivotColumn($column)
*/
public function detach($ids = null, $touch = true)
{
if ($this->using) {
if ($this->using && ! empty($ids)) {
$results = $this->detachUsingCustomClass($ids);
} else {
$query = $this->newPivotQuery();

0 comments on commit cadea88

Please sign in to comment.