| Conditions | 3 |
| Paths | 3 |
| Total Lines | 21 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 13 |
| CRAP Score | 3 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 33 | 2 | public function apply($model) |
|
| 34 | { |
||
| 35 | 2 | $value = $this->value(); |
|
| 36 | 2 | if (is_null($value)) { |
|
| 37 | 1 | return; |
|
| 38 | } |
||
| 39 | |||
| 40 | 1 | if ($this->isRange()) { |
|
| 41 | $model->when($value['from'] ?? null, function ($query, $value) { |
||
| 42 | 1 | return $query->whereDate($this->field()->name(), '>=', $value); |
|
| 43 | 1 | }); |
|
| 44 | $model->when($value['to'] ?? null, function ($query, $value) { |
||
| 45 | 1 | return $query->whereDate($this->field()->name(), '<=', $value); |
|
| 46 | 1 | }); |
|
| 47 | 1 | return; |
|
| 48 | } |
||
| 49 | |||
| 50 | 1 | $model->whereDate( |
|
| 51 | 1 | $this->field()->name(), |
|
| 52 | 1 | $this->sign, |
|
| 53 | $value |
||
| 54 | ); |
||
| 57 |