Conditions | 2 |
Paths | 2 |
Total Lines | 34 |
Code Lines | 15 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
23 | public function limit($value) |
||
24 | { |
||
25 | if ($this->parent->exists) { |
||
26 | $this->query->limit($value); |
||
27 | } else { |
||
28 | $grammar = $this->getEagerLimitGrammar(); |
||
29 | |||
30 | // TODO |
||
31 | $sql = $grammar->compileFirstPathSegment( |
||
32 | $this->related->qualifyColumn( |
||
33 | $this->related->getPathName() |
||
34 | ) |
||
35 | ); |
||
36 | |||
37 | $column = new Expression($sql); |
||
38 | |||
39 | // TODO |
||
40 | // if ($grammar instanceof MySqlGrammar && $grammar->useLegacyGroupLimit($this->query->getQuery())) { |
||
41 | // $column = 'laravel_through_key'; |
||
42 | // } |
||
43 | |||
44 | $this->query->groupLimit($value, $column); |
||
45 | |||
46 | $this->query->getQuery()->addBinding( |
||
47 | array_fill( |
||
48 | 0, |
||
49 | substr_count($sql, '?'), |
||
50 | $this->related->getPathSeparator() |
||
51 | ), |
||
52 | 'groupBy' |
||
53 | ); |
||
54 | } |
||
55 | |||
56 | return $this; |
||
57 | } |
||
59 |