public function join($table, $one, $operator = null, $two = null, $type = 'inner', $where = false)
{
$join = new JoinClause($this, $type, $table);
// 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) {
call_user_func($one, $join);
$this->joins[] = $join;
$this->addBinding($join->getBindings(), 'join');
} else {
$method = $where ? 'where' : 'on';
$this->joins[] = $join->{$method}($one, $operator, $two);
$this->addBinding($join->getBindings(), 'join');
}
return $this;
}