Conditions | 4 |
Paths | 3 |
Total Lines | 22 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Tests | 12 |
CRAP Score | 4 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
12 | 1 | protected function withPropertyConstraint(Builder $query, $value, $property): Builder |
|
13 | { |
||
14 | 1 | if (is_array($value)) { |
|
15 | 1 | array_map( |
|
16 | 1 | function ($value) { |
|
17 | 1 | if ($value instanceof \DateTimeInterface) { |
|
18 | 1 | return $value->format('Y-m-d'); |
|
19 | } |
||
20 | |||
21 | 1 | return $value; |
|
22 | 1 | }, |
|
23 | $value |
||
24 | ); |
||
25 | |||
26 | 1 | return $query->whereIn(DB::raw("date({$property})"), $value); |
|
|
|||
27 | } |
||
28 | |||
29 | 1 | if ($value instanceof \DateTimeInterface) { |
|
30 | 1 | $value = $value->format('Y-m-d'); |
|
31 | } |
||
32 | |||
33 | 1 | return $query->whereDate($property, $value); |
|
34 | } |
||
36 |