本文整理汇总了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;
}