WithRelationCriterion::apply()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 1
dl 0
loc 6
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Napp\Core\Dbal\Criteria;
4
5
class WithRelationCriterion implements CriterionInterface
6
{
7
    /**
8
     * @var array|string
9
     */
10
    protected $relation;
11
12
    /**
13
     * @param array|string $relation
14
     */
15
    public function __construct($relation)
16
    {
17
        $this->relation = $relation;
18
    }
19
20
    /**
21
     * @param \Illuminate\Database\Eloquent\Builder $query
22
     *
23
     * @return \Illuminate\Database\Eloquent\Builder
24
     */
25
    public function apply($query)
26
    {
27
        $query->with($this->relation);
28
29
        return $query;
30
    }
31
}
32