3 namespace BookStack\Exports\ZipExports\Models;
5 use BookStack\Activity\Models\Tag;
6 use BookStack\Exports\ZipExports\ZipValidationHelper;
8 class ZipExportTag extends ZipExportModel
11 public ?string $value = null;
12 public ?int $order = null;
14 public static function fromModel(Tag $model): self
16 $instance = new self();
17 $instance->name = $model->name;
18 $instance->value = $model->value;
19 $instance->order = $model->order;
24 public static function fromModelArray(array $tagArray): array
26 return array_values(array_map(self::fromModel(...), $tagArray));
29 public static function validate(ZipValidationHelper $context, array $data): array
32 'name' => ['required', 'string', 'min:1'],
33 'value' => ['nullable', 'string'],
34 'order' => ['nullable', 'integer'],
37 return $context->validateData($data, $rules);