Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 5a6f6da70a |
+43
-1
@@ -73,6 +73,48 @@ class ActiveQuery extends QueryTrait implements ISqlBuilder
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param string $column
|
||||
* @param int|float $amount
|
||||
* @return bool
|
||||
*/
|
||||
public function increment(string $column, int|float $amount = 1): bool
|
||||
{
|
||||
return (bool)$this->buildCommand($this->builder->mathematics([$column => $amount]))->exec();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param array $attributes
|
||||
* @return bool
|
||||
*/
|
||||
public function increments(array $attributes): bool
|
||||
{
|
||||
return (bool)$this->buildCommand($this->builder->mathematics($attributes))->exec();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param string $column
|
||||
* @param int|float $amount
|
||||
* @return bool
|
||||
*/
|
||||
public function decrement(string $column, int|float $amount = 1): bool
|
||||
{
|
||||
return (bool)$this->buildCommand($this->builder->mathematics([$column => $amount], '-'))->exec();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param array $attributes
|
||||
* @return bool
|
||||
*/
|
||||
public function decrements(array $attributes): bool
|
||||
{
|
||||
return (bool)$this->buildCommand($this->builder->mathematics($attributes, '-'))->exec();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @throws
|
||||
*/
|
||||
@@ -95,7 +137,7 @@ class ActiveQuery extends QueryTrait implements ISqlBuilder
|
||||
return;
|
||||
}
|
||||
if (Context::inCoroutine()) {
|
||||
Coroutine::create(fn() => $closure($data));
|
||||
Coroutine::create(fn () => $closure($data));
|
||||
} else {
|
||||
call_user_func($closure, $data);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user