1: <?php namespace Laravel\Database\Query;
2:
3: class Join {
4:
5: /**
6: * The type of join being performed.
7: *
8: * @var string
9: */
10: public $type;
11:
12: /**
13: * The table the join clause is joining to.
14: *
15: * @var string
16: */
17: public $table;
18:
19: /**
20: * The ON clauses for the join.
21: *
22: * @var array
23: */
24: public $clauses = array();
25:
26: /**
27: * Create a new query join instance.
28: *
29: * @param string $type
30: * @param string $table
31: * @return void
32: */
33: public function __construct($type, $table)
34: {
35: $this->type = $type;
36: $this->table = $table;
37: }
38:
39: /**
40: * Add an ON clause to the join.
41: *
42: * @param string $column1
43: * @param string $operator
44: * @param string $column2
45: * @param string $connector
46: * @return Join
47: */
48: public function on($column1, $operator, $column2, $connector = 'AND')
49: {
50: $this->clauses[] = compact('column1', 'operator', 'column2', 'connector');
51:
52: return $this;
53: }
54:
55: /**
56: * Add an OR ON clause to the join.
57: *
58: * @param string $column1
59: * @param string $operator
60: * @param string $column2
61: * @return Join
62: */
63: public function or_on($column1, $operator, $column2)
64: {
65: return $this->on($column1, $operator, $column2, 'OR');
66: }
67:
68: }