<?php
|
|
|
|
namespace App\Http\Requests;
|
|
|
|
use App\Enums\DurationModifier;
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
use Illuminate\Validation\Rules\Enum;
|
|
|
|
class CalculateDurationRequest extends FormRequest
|
|
{
|
|
public function authorize(): bool
|
|
{
|
|
return true;
|
|
}
|
|
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
'start.date' => ['required', 'date_format:Y-m-d'],
|
|
'start.timezone' => ['nullable', 'timezone:all'],
|
|
'end.date' => ['required', 'date_format:Y-m-d'],
|
|
'end.timezone' => ['nullable', 'timezone:all'],
|
|
'convert_to' => ['nullable', new Enum(DurationModifier::class)],
|
|
];
|
|
}
|
|
}
|