id = $model->id; $instance->name = $model->name; $instance->html = (new PageContent($model))->render(); $instance->priority = $model->priority; if (!empty($model->markdown)) { $instance->markdown = $model->markdown; } $instance->tags = ZipExportTag::fromModelArray($model->tags()->get()->all()); $instance->attachments = ZipExportAttachment::fromModelArray($model->attachments()->get()->all(), $files); return $instance; } /** * @param Page[] $pageArray * @return self[] */ public static function fromModelArray(array $pageArray, ZipExportFiles $files): array { return array_values(array_map(function (Page $page) use ($files) { return self::fromModel($page, $files); }, $pageArray)); } }