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

ParserWithTrait::parserWith()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 4
nc 2
nop 0
dl 0
loc 7
rs 10
c 0
b 0
f 0
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
}