HasRelationships::withRelationships()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 1 Features 0
Metric Value
cc 1
eloc 2
c 2
b 1
f 0
nc 1
nop 1
dl 0
loc 5
rs 10
1
<?php
2
3
namespace Sfneal\Queries\Traits;
4
5
// todo: add tests with relationship
6
7
trait HasRelationships
8
{
9
    /**
10
     * @var array
11
     */
12
    protected $relationships = [];
13
14
    /**
15
     * Dynamically eager load model relationships.
16
     *
17
     * @param  array  $relationships
18
     * @return $this
19
     */
20
    public function withRelationships(array $relationships = []): self
21
    {
22
        $this->relationships = $relationships;
23
24
        return $this;
25
    }
26
}
27