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

union() public method

Add a union statement to the query.
public union ( Builder | Closure $query, boolean $all = false ) : Builder | static
$query Builder | Closure
$all boolean
return Builder | static
    public function union($query, $all = false)
    {
        if ($query instanceof Closure) {
            call_user_func($query, $query = $this->newQuery());
        }
        $this->unions[] = compact('query', 'all');
        $this->addBinding($query->getBindings(), 'union');
        return $this;
    }

Usage Example

Exemplo n.º 1
0
 /**
  * Add a union statement to the query.
  *
  * @param \Illuminate\Database\Query\Builder|\Closure $query
  * @param bool $all
  * @return \Illuminate\Database\Query\Builder|static 
  * @static 
  */
 public static function union($query, $all = false)
 {
     return \Illuminate\Database\Query\Builder::union($query, $all);
 }