| Conditions | 5 |
| Paths | 3 |
| Total Lines | 18 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 11 |
| CRAP Score | 5 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 23 | 50 | public function match(array $models, Collection $results, $relation) |
|
| 24 | { |
||
| 25 | 50 | parent::match($models, $results, $relation); |
|
| 26 | |||
| 27 | 50 | if (!$this->parent->exists && !$this->andSelf) { |
|
| 28 | 30 | $limit = $this->query->getQuery()->groupLimit; |
|
| 29 | |||
| 30 | 30 | if ($limit) { |
|
| 31 | 10 | foreach ($models as $model) { |
|
| 32 | 10 | $model->setRelation( |
|
| 33 | 10 | $relation, |
|
| 34 | 10 | $model->getRelation($relation)->take($limit['value'] - 1) |
|
| 35 | 10 | ); |
|
| 36 | } |
||
| 37 | } |
||
| 38 | } |
||
| 39 | |||
| 40 | 50 | return $models; |
|
| 41 | } |
||
| 58 |