|string> */ public function rules(): array { $rules = [ "files" => "required|array", "folders" => "required|array", "object_type" => [ "required", new Enum(FileObjectType::class), ], "object_id" => "min:0", "names" => "array", "folder_id" => "min:0", "uuid" => "max:40" ]; if (! $this->request->has("object_id")) { $rules['uuid'] = "required|max:40"; } $extensions = ['jpg','txt', 'jpeg', 'png', 'gif', 'pdf', 'xls', 'xlsx', 'zip', 'wps', 'docx', 'doc','mpp','pptx','mp4','avi','mpeg','mov']; if ($this->request->get("object_type") == FileObjectType::CONTAINER->value) { $extensions = [...$extensions, ...config("bim.extensions")]; } $rules['files.*'] = [ File::default()->max("2gb"), function ($attribute, UploadedFile $value, $fail) use ($extensions) { if (! in_array($value->getClientOriginalExtension(), $extensions) && !in_array($value->getExtension(), $extensions)) { $fail(sprintf("Please select the correct file, the following files are supported: %s", implode(",", $extensions))); } } ]; return $rules; } }