This commit is contained in:
Adrian Hopek
2022-01-26 10:56:25 +01:00
parent 026bfe485f
commit f3559930c2
28 changed files with 1015 additions and 31 deletions

View File

@@ -0,0 +1,33 @@
<?php
declare(strict_types=1);
namespace Toby\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rules\Enum;
use Toby\Enums\VacationType;
use Toby\Rules\YearPeriodExists;
class VacationRequestRequest extends FormRequest
{
public function rules(): array
{
return [
"type" => ["required", new Enum(VacationType::class)],
"from" => ["required", "date_format:Y-m-d", new YearPeriodExists()],
"to" => ["required", "date_format:Y-m-d", new YearPeriodExists()],
"comment" => ["nullable"],
];
}
public function data(): array
{
return [
"type" => $this->get("type"),
"from" => $this->get("from"),
"to" => $this->get("to"),
"comment" => $this->get("comment"),
];
}
}