Passed
Push — feature/optimize ( 219eef...0e0305 )
by Fu
03:34
created

ParserWithTrait   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 9
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 9
rs 10
c 0
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A parserWith() 0 7 2
1
<?php
2
3
4
namespace Modules\Core\Traits\Criteria;
5
6
/**
7
 * Class ParserWithTrait
8
 *
9
 * @property \Illuminate\Http\Request $request
10
 * @property \Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Model|\Illuminate\Database\Query\Builder $model
11
 * @package Modules\Core\Traits\Criteria
12
 */
13
trait ParserWithTrait
14
{
15
    protected function parserWith()
16
    {
17
        $this->with = $this->request->get(config('repository.criteria.params.with', 'with'), null);
0 ignored issues
show
Bug Best Practice introduced by
The property with does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
18
19
        if ($this->with) {
20
            $this->with = explode(';', $this->with);
21
            $this->model = $this->model->with($this->with);
22
        }
23
    }
24
}