id = $model->id; $instance->name = $model->name; $instance->type = $model->type; $instance->file = $files->referenceForImage($model); return $instance; } public static function validate(ZipValidationHelper $context, array $data): array { $rules = [ 'id' => ['nullable', 'int'], 'name' => ['required', 'string', 'min:1'], 'file' => ['required', 'string', $context->fileReferenceRule()], 'type' => ['required', 'string', Rule::in(['gallery', 'drawio'])], ]; return $context->validateData($data, $rules); } }