/** * Add a join clause to the query. * * @param string $table * @param string $column1 * @param string $operator * @param string $column2 * @param string $type * @return Query */ public function join($table, $column1, $operator = null, $column2 = null, $type = 'INNER') { // If the "column" is really an instance of a Closure, the developer is // trying to create a join with a complex "ON" clause. So, we will add // the join, and then call the Closure with the join/ if ($column1 instanceof Closure) { $this->joins[] = new Query\Join($type, $table); call_user_func($column1, end($this->joins)); } else { $join = new Query\Join($type, $table); $join->on($column1, $operator, $column2); $this->joins[] = $join; } return $this; }
public function join($table, $column1, $operator = null, $column2 = null, $type = 'INNER') { if ($column1 instanceof Closure) { $this->joins[] = new Query\Join($type, $table); call_user_func($column1, end($this->joins)); } else { $join = new Query\Join($type, $table); $join->on($column1, $operator, $column2); $this->joins[] = $join; } return $this; }