Passed
Push — master ( 2ebb51...c237bf )
by Jonas
05:46
created

MorphOneOrMany   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 5
c 2
b 0
f 0
dl 0
loc 18
ccs 3
cts 3
cp 1
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A getRelationExistenceQuery() 0 4 1
1
<?php
2
3
namespace Staudenmeir\EloquentJsonRelations\Relations\Postgres;
4
5
use Illuminate\Database\Eloquent\Builder;
6
7
trait MorphOneOrMany
8
{
9
    use HasOneOrMany {
10
        getRelationExistenceQuery as getRelationExistenceQueryParent;
11
    }
12
13
    /**
14
     * Add the constraints for a relationship query.
15
     *
16
     * @param \Illuminate\Database\Eloquent\Builder $query
17
     * @param \Illuminate\Database\Eloquent\Builder $parentQuery
18
     * @param array|mixed $columns
19
     * @return \Illuminate\Database\Eloquent\Builder
20
     */
21 2
    public function getRelationExistenceQuery(Builder $query, Builder $parentQuery, $columns = ['*'])
22
    {
23 2
        return $this->getRelationExistenceQueryParent($query, $parentQuery, $columns)
24 2
            ->where($this->morphType, $this->morphClass);
25
    }
26
}
27