Skip to content

Commit

Permalink
Rename qualifyColumn to qualifyPivotColumn in BelongsToMany & MorphTo…
Browse files Browse the repository at this point in the history
…Many (#35276)
  • Loading branch information
ddzobov committed Nov 18, 2020
1 parent d09bf01 commit 31e080c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
16 changes: 8 additions & 8 deletions src/Illuminate/Database/Eloquent/Relations/BelongsToMany.php
Expand Up @@ -362,7 +362,7 @@ public function wherePivot($column, $operator = null, $value = null, $boolean =
{
$this->pivotWheres[] = func_get_args();

return $this->where($this->qualifyColumn($column), $operator, $value, $boolean);
return $this->where($this->qualifyPivotColumn($column), $operator, $value, $boolean);
}

/**
Expand All @@ -376,7 +376,7 @@ public function wherePivot($column, $operator = null, $value = null, $boolean =
*/
public function wherePivotBetween($column, array $values, $boolean = 'and', $not = false)
{
return $this->whereBetween($this->qualifyColumn($column), $values, $boolean, $not);
return $this->whereBetween($this->qualifyPivotColumn($column), $values, $boolean, $not);
}

/**
Expand Down Expand Up @@ -429,7 +429,7 @@ public function wherePivotIn($column, $values, $boolean = 'and', $not = false)
{
$this->pivotWhereIns[] = func_get_args();

return $this->whereIn($this->qualifyColumn($column), $values, $boolean, $not);
return $this->whereIn($this->qualifyPivotColumn($column), $values, $boolean, $not);
}

/**
Expand Down Expand Up @@ -524,7 +524,7 @@ public function wherePivotNull($column, $boolean = 'and', $not = false)
{
$this->pivotWhereNulls[] = func_get_args();

return $this->whereNull($this->qualifyColumn($column), $boolean, $not);
return $this->whereNull($this->qualifyPivotColumn($column), $boolean, $not);
}

/**
Expand Down Expand Up @@ -810,7 +810,7 @@ protected function aliasedPivotColumns()
$defaults = [$this->foreignPivotKey, $this->relatedPivotKey];

return collect(array_merge($defaults, $this->pivotColumns))->map(function ($column) {
return $this->qualifyColumn($column).' as pivot_'.$column;
return $this->qualifyPivotColumn($column).' as pivot_'.$column;
})->unique()->all();
}

Expand Down Expand Up @@ -1230,7 +1230,7 @@ public function getForeignPivotKeyName()
*/
public function getQualifiedForeignPivotKeyName()
{
return $this->qualifyColumn($this->foreignPivotKey);
return $this->qualifyPivotColumn($this->foreignPivotKey);
}

/**
Expand All @@ -1250,7 +1250,7 @@ public function getRelatedPivotKeyName()
*/
public function getQualifiedRelatedPivotKeyName()
{
return $this->qualifyColumn($this->relatedPivotKey);
return $this->qualifyPivotColumn($this->relatedPivotKey);
}

/**
Expand Down Expand Up @@ -1339,7 +1339,7 @@ public function getPivotColumns()
* @param string $column
* @return string
*/
public function qualifyColumn($column)
public function qualifyPivotColumn($column)
{
return Str::contains($column, '.')
? $column
Expand Down
8 changes: 4 additions & 4 deletions src/Illuminate/Database/Eloquent/Relations/MorphToMany.php
Expand Up @@ -68,7 +68,7 @@ protected function addWhereConstraints()
{
parent::addWhereConstraints();

$this->query->where($this->qualifyColumn($this->morphType), $this->morphClass);
$this->query->where($this->qualifyPivotColumn($this->morphType), $this->morphClass);

return $this;
}
Expand All @@ -83,7 +83,7 @@ public function addEagerConstraints(array $models)
{
parent::addEagerConstraints($models);

$this->query->where($this->qualifyColumn($this->morphType), $this->morphClass);
$this->query->where($this->qualifyPivotColumn($this->morphType), $this->morphClass);
}

/**
Expand Down Expand Up @@ -111,7 +111,7 @@ protected function baseAttachRecord($id, $timed)
public function getRelationExistenceQuery(Builder $query, Builder $parentQuery, $columns = ['*'])
{
return parent::getRelationExistenceQuery($query, $parentQuery, $columns)->where(
$this->qualifyColumn($this->morphType), $this->morphClass
$this->qualifyPivotColumn($this->morphType), $this->morphClass
);
}

Expand Down Expand Up @@ -173,7 +173,7 @@ protected function aliasedPivotColumns()
$defaults = [$this->foreignPivotKey, $this->relatedPivotKey, $this->morphType];

return collect(array_merge($defaults, $this->pivotColumns))->map(function ($column) {
return $this->qualifyColumn($column).' as pivot_'.$column;
return $this->qualifyPivotColumn($column).' as pivot_'.$column;
})->unique()->all();
}

Expand Down

0 comments on commit 31e080c

Please sign in to comment.