Merge branch 'main' into #20-vacation-requests
# Conflicts: # app/Architecture/Providers/ObserverServiceProvider.php # app/Domain/Role.php # app/Domain/Rules/ApprovedVacationDaysInSameRange.php # app/Domain/Rules/DoesNotExceedLimitRule.php # app/Domain/Rules/MinimumOneVacationDayRule.php # app/Domain/Rules/PendingVacationRequestInSameRange.php # app/Domain/Rules/UsedVacationDaysInSameRange.php # app/Domain/Rules/VacationRequestRule.php # app/Domain/VacationRequestState.php # app/Domain/VacationRequestStateManager.php # app/Domain/VacationRequestValidator.php # app/Domain/VacationType.php # app/Domain/VacationTypeConfigRetriever.php # app/Eloquent/Models/User.php # app/Infrastructure/Http/Controllers/UserController.php # app/Infrastructure/Http/Kernel.php # app/Infrastructure/Http/Requests/UserRequest.php # database/factories/UserFactory.php # database/seeders/DatabaseSeeder.php # routes/web.php # tests/Feature/UserTest.php
This commit is contained in:
33
app/Infrastructure/Http/Requests/VacationRequestRequest.php
Normal file
33
app/Infrastructure/Http/Requests/VacationRequestRequest.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Toby\Infrastructure\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Validation\Rules\Enum;
|
||||
use Toby\Domain\Enums\VacationType;
|
||||
use Toby\Infrastructure\Http\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"),
|
||||
];
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user