Ejemplo n.º 1
0
 /**
  * Add a join clause to the query.
  *
  * @param  string  $table
  * @param  string  $one
  * @param  string  $operator
  * @param  string  $two
  * @param  string  $type
  * @param  bool    $where
  * @return $this
  */
 public function join($table, $one, $operator = null, $two = null, $type = 'inner', $where = false)
 {
     // If the first "column" of the join is really a Closure instance the developer
     // is trying to build a join with a complex "on" clause containing more than
     // one condition, so we'll add the join and call a Closure with the query.
     if ($one instanceof Closure) {
         $this->joins[] = new JoinClause($type, $table);
         call_user_func($one, end($this->joins));
     } else {
         $join = new JoinClause($type, $table);
         $this->joins[] = $join->on($one, $operator, $two, 'and', $where);
     }
     return $this;
 }
Ejemplo n.º 2
0
 /**
  * Add a join clause to the query.
  *
  * @param  string  $table
  * @param  string  $one
  * @param  string  $operator
  * @param  string  $two
  * @param  string  $type
  * @param  bool    $where
  * @return $this
  */
 public function join($table, $one, $operator = null, $two = null, $type = 'inner', $where = false)
 {
     if ($one instanceof Closure) {
         $this->joins[] = new JoinClause($type, $table);
         call_user_func($one, end($this->joins));
     } else {
         $join = new JoinClause($type, $table);
         $this->joins[] = $join->on($one, $operator, $two, 'and', $where);
     }
     return $this;
 }