Skip to content

Commit

Permalink
Merge pull request #29405 from staudenmeir/update-alias
Browse files Browse the repository at this point in the history
[5.8] Fix UPDATE queries with alias
  • Loading branch information
taylorotwell authored Aug 4, 2019
2 parents 8267e24 + da0ed9c commit 22e9a9e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Illuminate/Database/Query/Grammars/PostgresGrammar.php
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ protected function compileUpdateColumns($query, $values)
// columns and convert it to a parameter value. Then we will concatenate a
// list of the columns that can be added into this update query clauses.
return collect($values)->map(function ($value, $key) use ($query) {
$column = Str::after($key, $query->from.'.');
$column = Str::after($key, '.');

if ($this->isJsonSelector($key)) {
return $this->compileJsonUpdateColumn($column, $value);
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Database/Query/Grammars/SQLiteGrammar.php
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ public function compileUpdate(Builder $query, $values)
$table = $this->wrapTable($query->from);

$columns = collect($values)->map(function ($value, $key) use ($query) {
return $this->wrap(Str::after($key, $query->from.'.')).' = '.$this->parameter($value);
return $this->wrap(Str::after($key, '.')).' = '.$this->parameter($value);
})->implode(', ');

if (isset($query->joins) || isset($query->limit)) {
Expand Down

0 comments on commit 22e9a9e

Please sign in to comment.