本文整理匯總了PHP中Illuminate\Database\Query\Grammars\Grammar::wrap方法的典型用法代碼示例。如果您正苦於以下問題:PHP Grammar::wrap方法的具體用法?PHP Grammar::wrap怎麽用?PHP Grammar::wrap使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Illuminate\Database\Query\Grammars\Grammar
的用法示例。
在下文中一共展示了Grammar::wrap方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: decrement
/**
* Decrement a column's value by a given amount.
*
* @param string $column
* @param int $amount
* @param array $extra
* @return int
*/
public function decrement($column, $amount = 1, array $extra = [])
{
if (!is_numeric($amount)) {
throw new InvalidArgumentException('Non-numeric value passed to decrement method.');
}
$wrapped = $this->grammar->wrap($column);
$columns = array_merge([$column => $this->raw("{$wrapped} - {$amount}")], $extra);
return $this->update($columns);
}
示例2: decrement
/**
* Decrement a column's value by a given amount.
*
* @param string $column
* @param int $amount
* @param array $extra
* @return int
*/
public function decrement($column, $amount = 1, array $extra = [])
{
$wrapped = $this->grammar->wrap($column);
$columns = array_merge([$column => $this->raw("{$wrapped} - {$amount}")], $extra);
return $this->update($columns);
}
示例3: decrement
/**
* Decrement a column's value by a given amount.
*
* @param string $column
* @param int $amount
* @return int
*/
public function decrement($column, $amount = 1)
{
$wrapped = $this->grammar->wrap($column);
return $this->update(array($column => $this->raw("{$wrapped} - {$amount}")));
}