Skip to content

Commit 58888db

Browse files
committed
format
to reduce diff against original Eloquent Model code.
1 parent d3f0274 commit 58888db

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/Kitar/Dynamodb/Model/Model.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -176,20 +176,19 @@ public function save(array $options = [])
176176
*/
177177
protected function incrementOrDecrement($column, $amount, $extra, $method)
178178
{
179+
$query = $this->newQuery()->key($this->getKey());
180+
179181
if (! $this->exists) {
180-
return $this->newQuery()
181-
->key($this->getKey())
182-
->{$method}($column, $amount, $extra);
182+
return $query->{$method}($column, $amount, $extra);
183183
}
184184

185185
if ($this->fireModelEvent('updating') === false) {
186186
return false;
187187
}
188188

189-
return tap($this->newQuery()
190-
->key($this->getKey())
191-
->{$method}($column, $amount, $extra), function ($response) use($column, $amount, $method) {
189+
return tap($query->{$method}($column, $amount, $extra), function ($response) {
192190
$this->forceFill($response['Attributes']);
191+
193192
$this->syncChanges();
194193

195194
$this->fireModelEvent('updated', false);

0 commit comments

Comments
 (0)