From a0cedeb752e36b40a1ea78ef7d65ff2ba5104e4c Mon Sep 17 00:00:00 2001 From: Adrian Hopek Date: Fri, 4 Feb 2022 10:51:13 +0100 Subject: [PATCH] #40 - fix --- .../Http/Requests/VacationRequestRequest.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/Infrastructure/Http/Requests/VacationRequestRequest.php b/app/Infrastructure/Http/Requests/VacationRequestRequest.php index eeea29b..3fd9e9f 100644 --- a/app/Infrastructure/Http/Requests/VacationRequestRequest.php +++ b/app/Infrastructure/Http/Requests/VacationRequestRequest.php @@ -5,8 +5,10 @@ declare(strict_types=1); namespace Toby\Infrastructure\Http\Requests; use Illuminate\Foundation\Http\FormRequest; +use Illuminate\Support\Carbon; use Illuminate\Validation\Rules\Enum; use Toby\Domain\Enums\VacationType; +use Toby\Eloquent\Models\YearPeriod; use Toby\Infrastructure\Http\Rules\YearPeriodExists; class VacationRequestRequest extends FormRequest @@ -23,10 +25,13 @@ class VacationRequestRequest extends FormRequest public function data(): array { + $from = $this->get("from"); + return [ "type" => $this->get("type"), - "from" => $this->get("from"), + "from" => $from, "to" => $this->get("to"), + "year_period_id" => YearPeriod::findByYear(Carbon::create($from)->year)->id, "comment" => $this->get("comment"), ]; }