12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- <?php
- namespace App\Http\Requests\API\File;
- use App\Models\Enums\FileObjectType;
- use Illuminate\Foundation\Http\FormRequest;
- use Illuminate\Validation\Rules\Enum;
- use Illuminate\Validation\Rules\File;
- class KeepDirectoryUploadRequest extends FormRequest
- {
- /**
- * Determine if the user is authorized to make this request.
- */
- public function authorize(): bool
- {
- return true;
- }
- /**
- * Get the validation rules that apply to the request.
- *
- * @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
- */
- public function rules(): array
- {
- $rules = [
- "files" => "required|array",
- "folders" => "required|array",
- "object_type" => [
- "required",
- new Enum(FileObjectType::class),
- ],
- "object_id" => "required|min:0",
- "names" => "array",
- "folder_id" => "min:0"
- ];
- $rules['files.*'][] = File::types(['txt', 'jpeg', 'png', 'gif', 'pdf', 'xls', 'xlsx', 'zip', 'wps', 'docx', 'doc'])->max("2gb");
- return $rules;
- }
- }
|