Skip to content

Commit

Permalink
update method signature and use force fill
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Apr 10, 2017
1 parent a3e1acc commit 1728a88
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/Illuminate/Database/Eloquent/Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ protected function incrementOrDecrement($column, $amount, $extra, $method)
return $query->{$method}($column, $amount, $extra);
}

$this->incrementOrDecrementAttributeValue($column, $amount, $method, $extra);
$this->incrementOrDecrementAttributeValue($column, $amount, $extra, $method);

return $query->where(
$this->getKeyName(), $this->getKey()
Expand All @@ -422,13 +422,15 @@ protected function incrementOrDecrement($column, $amount, $extra, $method)
*
* @param string $column
* @param int $amount
* @param array $extra
* @param string $method
* @return void
*/
protected function incrementOrDecrementAttributeValue($column, $amount, $method, $extra = [])
protected function incrementOrDecrementAttributeValue($column, $amount, $extra, $method)
{
$this->{$column} = $this->{$column} + ($method == 'increment' ? $amount : $amount * -1);
$this->fill($extra);

$this->forceFill($extra);

$this->syncOriginalAttribute($column);
}
Expand Down

0 comments on commit 1728a88

Please sign in to comment.