本文整理汇总了PHP中Illuminate\Database\Query\Builder::addBinding方法的典型用法代码示例。如果您正苦于以下问题:PHP Builder::addBinding方法的具体用法?PHP Builder::addBinding怎么用?PHP Builder::addBinding使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Database\Query\Builder
的用法示例。
在下文中一共展示了Builder::addBinding方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: on
/**
* Add an "on" clause to the join.
*
* @param string $first
* @param string $operator
* @param string $second
* @param string $boolean
* @param bool $where
* @return \Illuminate\Database\Query\JoinClause
*/
public function on($first, $operator, $second, $boolean = 'and', $where = false)
{
$this->clauses[] = compact('first', 'operator', 'second', 'boolean', 'where');
if ($where) {
$this->query->addBinding($second);
}
return $this;
}
示例2: whereCountQuery
/**
* Add a sub query count clause to the query.
*
* @param \Illuminate\Database\Query\Builder $query
* @param string $operator
* @param int $count
* @param string $boolean
* @return $this
*/
protected function whereCountQuery(QueryBuilder $query, $operator = '>=', $count = 1, $boolean = 'and')
{
if (is_numeric($count)) {
$count = new Expression($count);
}
$this->query->addBinding($query->getBindings(), 'where');
return $this->where(new Expression('(' . $query->toSql() . ')'), $operator, $count, $boolean);
}
示例3: mergeModelDefinedRelationWheresToHasQuery
/**
* Merge the "wheres" from a relation query to a has query.
*
* @param \Illuminate\Database\Eloquent\Builder $hasQuery
* @param \Illuminate\Database\Eloquent\Relations\Relation $relation
* @return void
*/
protected function mergeModelDefinedRelationWheresToHasQuery(Builder $hasQuery, Relation $relation)
{
// Here we have the "has" query and the original relation. We need to copy over any
// where clauses the developer may have put in the relationship function over to
// the has query, and then copy the bindings from the "has" query to the main.
$relationQuery = $relation->getBaseQuery();
$hasQuery->mergeWheres($relationQuery->wheres, $relationQuery->getBindings());
$this->query->addBinding($hasQuery->getQuery()->getBindings(), 'where');
}
示例4: addBinding
/**
* Add a binding to the query.
*
* @param mixed $value
* @param string $type
* @return $this
* @throws \InvalidArgumentException
* @static
*/
public static function addBinding($value, $type = 'where')
{
return \Illuminate\Database\Query\Builder::addBinding($value, $type);
}
示例5: compileJoins
/**
* Compile the "join" portions of the query.
*
* @param \Illuminate\Database\Query\Builder $query
* @param array $joins
* @return string
*/
protected function compileJoins(Builder $query, $joins)
{
$sql = array();
$query->setBindings(array(), 'join');
foreach ($joins as $join) {
$table = $this->wrapTable($join->table);
// First we need to build all of the "on" clauses for the join. There may be many
// of these clauses so we will need to iterate through each one and build them
// separately, then we'll join them up into a single string when we're done.
$clauses = array();
foreach ($join->clauses as $clause) {
$clauses[] = $this->compileJoinConstraint($clause);
}
foreach ($join->bindings as $binding) {
$query->addBinding($binding, 'join');
}
// Once we have constructed the clauses, we'll need to take the boolean connector
// off of the first clause as it obviously will not be required on that clause
// because it leads the rest of the clauses, thus not requiring any boolean.
$clauses[0] = $this->removeLeadingBoolean($clauses[0]);
$clauses = implode(' ', $clauses);
$type = $join->type;
// Once we have everything ready to go, we will just concatenate all the parts to
// build the final join statement SQL for the query and we can then return the
// final clause back to the callers as a single, stringified join statement.
$sql[] = "{$type} join {$table} on {$clauses}";
}
return implode(' ', $sql);
}