| Total Complexity | 3 |
| Total Lines | 51 |
| Duplicated Lines | 0 % |
| Coverage | 0% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 8 | class SearchRequest extends FormRequest |
||
| 9 | { |
||
| 10 | /** |
||
| 11 | * Request value of "start_date". |
||
| 12 | * |
||
| 13 | * @var \Illuminate\Support\Carbon |
||
| 14 | */ |
||
| 15 | public Carbon $start_date; |
||
| 16 | |||
| 17 | /** |
||
| 18 | * Request value of "end_date". |
||
| 19 | * |
||
| 20 | * @var \Illuminate\Support\Carbon |
||
| 21 | */ |
||
| 22 | public Carbon $end_date; |
||
| 23 | |||
| 24 | /** |
||
| 25 | * {@inheritDoc} |
||
| 26 | */ |
||
| 27 | public function validationData() |
||
| 34 | ]; |
||
| 35 | } |
||
| 36 | |||
| 37 | /** |
||
| 38 | * {@inheritDoc} |
||
| 39 | */ |
||
| 40 | public function rules() |
||
| 41 | { |
||
| 42 | return [ |
||
| 43 | 'start_date' => 'required|date_format:Y-m-d|after_or_equal:' . Carbon::today()->startOfMonth()->format('Y-m-d'), |
||
| 44 | 'end_date' => 'required|date_format:Y-m-d|before_or_equal:' . Carbon::today()->endOfMonth()->format('Y-m-d'), |
||
| 45 | ]; |
||
| 46 | } |
||
| 47 | |||
| 48 | /** |
||
| 49 | * Parse the given daterange value into start_date and end_date format. |
||
| 50 | * |
||
| 51 | * @param string $value |
||
| 52 | * @return array |
||
| 53 | */ |
||
| 54 | protected function parseDaterange(string $value): array |
||
| 59 | }); |
||
| 60 | } |
||
| 62 |