This commit is contained in:
2020-11-12 00:18:32 +08:00
parent e1c9e97b0c
commit 223a0850db
-65
View File
@@ -42,53 +42,6 @@ class ActiveRecord extends BaseActiveRecord
return [];
}
/**
* @param string $column
* @param int $value
* @return static|bool
* @throws Exception
*/
public function incrBy(string $column, int $value)
{
if (!$this->mathematics(self::INCR, [$column => $value])) {
return false;
}
$this->{$column} += $value;
return $this->refresh();
}
/**
* @param $column
* @param $value
* @return array|Command|bool|int|string
* @throws Exception
*/
public function decrBy(string $column, int $value)
{
if (!$this->mathematics(self::DECR, [$column => $value])) {
return false;
}
$this->{$column} -= $value;
return $this->refresh();
}
/**
* @param array $attributes
* @return bool|self
* @throws Exception
*/
public function batchIncrColumn(array $attributes)
{
if (!$this->mathematics(self::INCR, $attributes)) {
return false;
}
foreach ($attributes as $key => $attribute) {
$this->$key += $attribute;
}
return $this;
}
/**
* @param string $column
* @param int $value
@@ -154,24 +107,6 @@ class ActiveRecord extends BaseActiveRecord
return $this;
}
/**
* @param array $attributes
* @return bool|self
* @throws Exception
*/
public function batchDescColumn(array $attributes)
{
if (!$this->mathematics(self::DECR, $attributes)) {
return false;
}
foreach ($attributes as $key => $attribute) {
$this->$key -= $attribute;
}
return $this;
}
/**
* @param $attributes
* @param $condition