CreateRequest.php 876 B

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. namespace App\Http\Requests\API\Folder;
  3. use App\Models\Enums\FolderObjectType;
  4. use Illuminate\Foundation\Http\FormRequest;
  5. use Illuminate\Validation\Rules\Enum;
  6. class CreateRequest extends FormRequest
  7. {
  8. /**
  9. * Determine if the user is authorized to make this request.
  10. */
  11. public function authorize(): bool
  12. {
  13. return true;
  14. }
  15. /**
  16. * Get the validation rules that apply to the request.
  17. *
  18. * @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
  19. */
  20. public function rules(): array
  21. {
  22. return [
  23. "object_type" => [
  24. "required",
  25. new Enum(FolderObjectType::class),
  26. ],
  27. "object_id" => "required|numeric",
  28. "parent_id" => "required|numeric",
  29. "items" => "required",
  30. ];
  31. }
  32. }