This commit is contained in:
Adrian Hopek
2022-02-18 14:22:01 +01:00
parent fae50cb21c
commit b745ab990c
10 changed files with 162 additions and 8 deletions

View File

@@ -16,9 +16,11 @@ class VacationRequestRequest extends FormRequest
public function rules(): array
{
return [
"user" => ["required", "exists:users,id"],
"type" => ["required", new Enum(VacationType::class)],
"from" => ["required", "date_format:Y-m-d", new YearPeriodExists()],
"to" => ["required", "date_format:Y-m-d", new YearPeriodExists()],
"skipFlow" => ["required", "boolean"],
"comment" => ["nullable"],
];
}
@@ -28,11 +30,13 @@ class VacationRequestRequest extends FormRequest
$from = $this->get("from");
return [
"user_id" => $this->get("user"),
"type" => $this->get("type"),
"from" => $from,
"to" => $this->get("to"),
"year_period_id" => YearPeriod::findByYear(Carbon::create($from)->year)->id,
"comment" => $this->get("comment"),
"skip_flow" => $this->boolean("skipFlow"),
];
}
}