本文整理汇总了PHP中Illuminate\Database\Connection::raw方法的典型用法代码示例。如果您正苦于以下问题:PHP Connection::raw方法的具体用法?PHP Connection::raw怎么用?PHP Connection::raw使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Database\Connection
的用法示例。
在下文中一共展示了Connection::raw方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: doColumnSearch
/**
* Perform column search.
*/
public function doColumnSearch()
{
$columns = $this->input['columns'];
for ($i = 0, $c = count($columns); $i < $c; $i++) {
if ($this->isColumnSearchable($columns, $i)) {
$column = $columns[$i]['name'];
$keyword = $this->setupKeyword($columns[$i]['search']['value']);
if (isset($this->filter_columns[$column])) {
$method = $this->filter_columns[$column]['method'];
$parameters = $this->filter_columns[$column]['parameters'];
$this->compileFilterColumn($method, $parameters, $column);
} else {
$column = $this->wrapValue($column);
if ($this->isCaseInsensitive()) {
$this->query->whereRaw('LOWER(' . $column . ') LIKE ?', [Str::lower($keyword)]);
} else {
$col = strstr($column, '(') ? $this->connection->raw($column) : $column;
$this->query->whereRaw($col . ' LIKE ?', [$keyword]);
}
}
}
}
}
示例2: raw
/**
* Create a raw database expression.
*
* @param mixed $value
* @return \Illuminate\Database\Query\Expression
*/
public function raw($value)
{
return $this->connection->raw($value);
}
示例3: countNotRead
/**
* get number Notifications
* not read.
*
* @param $toId
* @param $entity
* @param Closure $filterScope
* @return mixed
*/
public function countNotRead($toId, $entity, Closure $filterScope = null)
{
$query = $this->notification->wherePolymorphic($toId, $entity)->withNotRead()->select($this->db->raw('Count(*) as notRead'));
$query = $this->applyFilter($filterScope, $query);
return $query->count();
}