1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
|
4
|
|
|
namespace Modules\Core\Traits\Criteria; |
5
|
|
|
|
6
|
|
|
|
7
|
|
|
trait ParserSearchWhereTrait |
8
|
|
|
{ |
9
|
|
|
use ParserSearchAndClosureTrait; |
10
|
|
|
use ParserSearchAndRelationClosureTrait; |
11
|
|
|
use ParserSearchOrClosureTrait; |
12
|
|
|
use ParserSearchOrRelationClosureTrait; |
13
|
|
|
|
14
|
|
|
protected function parserSearchWhere($value, $relation, $field, $condition) |
15
|
|
|
{ |
16
|
|
|
|
17
|
|
|
if ($this->isFirstField || $this->modelForceAndWhere) { |
18
|
|
|
$this->parserSearchAndWhere($value, $relation, $field, $condition); |
19
|
|
|
} else { |
20
|
|
|
$this->parserSearchOrWhere($value, $relation, $field, $condition); |
21
|
|
|
} |
22
|
|
|
} |
23
|
|
|
|
24
|
|
|
protected function parserSearchOrWhere($value, $relation, $field, $condition) |
25
|
|
|
{ |
26
|
|
|
if (!is_null($value)) { |
27
|
|
|
if (!is_null($relation)) { |
28
|
|
|
$this->parserSearchOrRelationClosure($value, $relation, $field, $condition); |
29
|
|
|
} else { |
30
|
|
|
$this->parserSearchOrClosure($value, $field, $condition); |
31
|
|
|
} |
32
|
|
|
} |
33
|
|
|
} |
34
|
|
|
|
35
|
|
|
protected function parserSearchAndWhere($value, $relation, $field, $condition) |
36
|
|
|
{ |
37
|
|
|
if (!is_null($value)) { |
38
|
|
|
if (!is_null($relation)) { |
39
|
|
|
$this->parserSearchAndRelationClosure($value, $relation, $field, $condition); |
40
|
|
|
} else { |
41
|
|
|
$this->parserSearchAndClosure($value, $field, $condition); |
42
|
|
|
} |
43
|
|
|
$this->isFirstField = false; |
|
|
|
|
44
|
|
|
} |
45
|
|
|
} |
46
|
|
|
} |