type = $type; $this->table = $table; $this->parent_connection = $parent_query->get_connection(); $this->parent_grammar = $parent_query->get_grammar(); $this->parent_processor = $parent_query->get_processor(); $this->parent_class = get_class( $parent_query ); parent::__construct( $app, $this->parent_connection, $this->parent_grammar, $this->parent_processor ); } /** * Add an "on" clause to the join. * * On clauses can be chained, e.g. * * $join->on('contacts.user_id', '=', 'users.id') * ->on('contacts.info_id', '=', 'info.id') * * will produce the following SQL: * * on `contacts`.`user_id` = `users`.`id` and `contacts`.`info_id` = `info`.`id` * * @param Closure|string $first * @param string|null $operator * @param string|null $second * @param string $boolean * * @return $this * * @throws InvalidArgumentException */ public function on( $first, $operator = null, $second = null, $boolean = 'and' ) { if ( $first instanceof Closure ) { return $this->where_nested( $first, $boolean ); } return $this->where_column( $first, $operator, $second, $boolean ); } /** * Add an "or on" clause to the join. * * @param Closure|string $first * @param string|null $operator * @param string|null $second * * @return Join */ public function or_on( $first, $operator = null, $second = null ) { return $this->on( $first, $operator, $second, 'or' ); } /** * Get a new instance of the join clause builder. * * @return Join */ public function new_query() { return new static( $this->app, $this->new_parent_query(), $this->type, $this->table ); } /** * Create a new query instance for sub-query. * * @return Builder */ protected function for_sub_query() { return $this->new_parent_query()->new_query(); } /** * Create a new parent query instance. * * @return Builder */ protected function new_parent_query() { $class = $this->parent_class; return new $class( $this->parent_connection, $this->parent_grammar, $this->parent_processor ); } }