@@ -342,7 +342,7 @@ protected function incrementOrDecrement(string $column, $amount, array $extra, s
342
342
$ this ->incrementOrDecrementAttributeValue ($ column , $ amount , $ extra , $ method );
343
343
344
344
return $ query ->where (
345
- $ this ->getKeyName (), $ this ->getKey ()[ 1 ]
345
+ $ this ->getKeyName (), $ this ->getKey ()
346
346
)->{$ method }($ column , $ amount , $ extra );
347
347
}
348
348
@@ -369,11 +369,7 @@ protected function incrementOrDecrement(string $column, $amount, array $extra, s
369
369
protected function incrementOrDecrementAttributeValue (string $ column , $ amount , $ extra , $ method )
370
370
{
371
371
$ columnValue = $ method === 'increment ' ? $ amount : $ amount * -1 ;
372
- if (!property_exists ($ this , $ column )) {
373
- $ this ->setAttribute ($ column , $ this ->getAttribute ($ column )[1 ] + $ columnValue );
374
- } else {
375
- $ this ->{$ column } = $ this ->{$ column } + $ columnValue ;
376
- }
372
+ $ this ->setAttribute ($ column , $ this ->getAttributeValue ($ column ) + $ columnValue );
377
373
378
374
$ this ->fill ($ extra );
379
375
@@ -893,12 +889,12 @@ public function getIncrementing()
893
889
/**
894
890
* Get the value of the model's primary key.
895
891
*
896
- * @return array
892
+ * @return string
897
893
* @throws DbException
898
894
*/
899
895
public function getKey ()
900
896
{
901
- return $ this ->getAttribute ($ this ->getKeyName ());
897
+ return $ this ->getAttributeValue ($ this ->getKeyName ());
902
898
}
903
899
904
900
/**
@@ -959,7 +955,7 @@ public function offsetExists($offset)
959
955
*/
960
956
public function offsetGet ($ offset )
961
957
{
962
- return $ this ->getAttribute ($ offset );
958
+ return $ this ->getAttributeValue ($ offset );
963
959
}
964
960
965
961
/**
0 commit comments