3
This commit is contained in:
@@ -42,53 +42,6 @@ class ActiveRecord extends BaseActiveRecord
|
|||||||
return [];
|
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 string $column
|
||||||
* @param int $value
|
* @param int $value
|
||||||
@@ -154,24 +107,6 @@ class ActiveRecord extends BaseActiveRecord
|
|||||||
return $this;
|
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 $attributes
|
||||||
* @param $condition
|
* @param $condition
|
||||||
|
|||||||
Reference in New Issue
Block a user