本文整理匯總了PHP中Illuminate\Database\Query\Builder::having方法的典型用法代碼示例。如果您正苦於以下問題:PHP Builder::having方法的具體用法?PHP Builder::having怎麽用?PHP Builder::having使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Illuminate\Database\Query\Builder
的用法示例。
在下文中一共展示了Builder::having方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: filtering
/**
* Perform column filtering
*
* @return mixed
*/
public function filtering()
{
$filters = $this->request->getFilter();
if ($filters) {
$this->columnMapping();
foreach ($filters as $key => $keyword) {
$keyword = '%' . $keyword . '%';
$column = $this->getColumnName($key);
if (in_array($key, $this->havingColumns)) {
$this->query->having($key, 'like', $keyword);
continue;
}
$this->query->where($column, 'like', $keyword);
}
}
}
示例2: having
/**
* Add a "having" clause to the query.
*
* @param string $column
* @param string $operator
* @param string $value
* @param string $boolean
* @return $this
* @static
*/
public static function having($column, $operator = null, $value = null, $boolean = 'and')
{
return \Illuminate\Database\Query\Builder::having($column, $operator, $value, $boolean);
}
示例3: _addQueryCondition
/**
* Adds condition to the query builder
*
* @param \Illuminate\Database\Query\Builder $builder
* @param string $type
* @param string $columnName
* @param string $operator
* @param string $value
* @return \Illuminate\Database\Query\Builder
*/
private function _addQueryCondition($builder, $type, $columnName, $operator, $value)
{
switch ($type) {
// Having by
case 'having':
$builder->having($columnName, $operator, $value);
break;
// Standard where statement
// Standard where statement
case 'where':
default:
$builder->where($columnName, $operator, $value);
break;
}
return $builder;
}