["required", "date_format:Y-m-d", new YearPeriodExists()], "to" => ["required", "date_format:Y-m-d", new YearPeriodExists()], ]; } public function from(): Carbon { return Carbon::create($this->request->get("from")); } public function to(): Carbon { return Carbon::create($this->request->get("to")); } public function yearPeriod(): YearPeriod { return YearPeriod::findByYear(Carbon::create($this->request->get("from"))->year); } }