Skip to content

Commit

Permalink
fix save keys on increment / decrement
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Sep 28, 2020
1 parent 0c4e150 commit 77db028
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/Illuminate/Database/Eloquent/Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -620,9 +620,7 @@ protected function incrementOrDecrement($column, $amount, $extra, $method)
return false;
}

return tap($query->where(
$this->getKeyName(), $this->getKey()
)->{$method}($column, $amount, $extra), function () use ($column) {
return tap($this->setKeysForSaveQuery($query)->{$method}($column, $amount, $extra), function () use ($column) {
$this->syncChanges();

$this->fireModelEvent('updated', false);
Expand Down Expand Up @@ -813,7 +811,7 @@ protected function performUpdate(Builder $query)
* @param \Illuminate\Database\Eloquent\Builder $query
* @return \Illuminate\Database\Eloquent\Builder
*/
protected function setKeysForSaveQuery(Builder $query)
protected function setKeysForSaveQuery($query)
{
$query->where($this->getKeyName(), '=', $this->getKeyForSaveQuery());

Expand Down

0 comments on commit 77db028

Please sign in to comment.