added increment method to query builder.

This commit is contained in:
Taylor Otwell
2011-10-12 21:27:29 -05:00
parent 68455378cc
commit 559785f168
2 changed files with 16 additions and 4 deletions

View File

@@ -581,6 +581,18 @@ class Query {
return (int) $this->connection->pdo->lastInsertId($sequence);
}
/**
* Increment the value of a column by a given amount.
*
* @param string $column
* @param int $amount
* @return int
*/
public function increment($column, $amount = 1)
{
return $this->update(array($column => Manager::raw($this->grammar->wrap($column).' + '.$amount)));
}
/**
* Update an array of values in the database table.
*