Simple problems require simple solutions
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
677 B

  1. <?php
  2. namespace App\Http\Requests;
  3. use App\Enums\DurationModifier;
  4. use Illuminate\Foundation\Http\FormRequest;
  5. use Illuminate\Validation\Rules\Enum;
  6. class CalculateDurationRequest extends FormRequest
  7. {
  8. public function authorize(): bool
  9. {
  10. return true;
  11. }
  12. public function rules(): array
  13. {
  14. return [
  15. 'start.date' => ['required', 'date_format:Y-m-d'],
  16. 'start.timezone' => ['nullable', 'timezone:all'],
  17. 'end.date' => ['required', 'date_format:Y-m-d'],
  18. 'end.timezone' => ['nullable', 'timezone:all'],
  19. 'convert_to' => ['nullable', new Enum(DurationModifier::class)],
  20. ];
  21. }
  22. }