WithCountRelation::apply()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 1
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Napp\Core\Dbal\Criteria;
4
5
class WithCountRelation implements CriterionInterface
6
{
7
    protected $relations = [];
8
9
    public function __construct($relations = [])
10
    {
11
        $this->relations = $relations;
12
    }
13
14
    /**
15
     * @param \Illuminate\Database\Eloquent\Builder $query
16
     *
17
     * @return \Illuminate\Database\Eloquent\Builder|void
18
     */
19
    public function apply($query)
20
    {
21
        $query->withCount($this->relations);
22
    }
23
}
24