Illuminate\Database\Query\Builder::addBinding PHP Method

addBinding() public method

Add a binding to the query.
public addBinding ( mixed $value, string $type = 'where' )
$value mixed
$type string
    public function addBinding($value, $type = 'where')
    {
        if (!array_key_exists($type, $this->bindings)) {
            throw new InvalidArgumentException("Invalid binding type: {$type}.");
        }
        if (is_array($value)) {
            $this->bindings[$type] = array_values(array_merge($this->bindings[$type], $value));
        } else {
            $this->bindings[$type][] = $value;
        }
        return $this;
    }

Usage Example

Exemplo n.º 1
0
 /**
  * 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;
 }
All Usage Examples Of Illuminate\Database\Query\Builder::addBinding