Goal-Calibration/data/seedDb.php

39 lines
677 B
PHP

<?php
$texts = [
[
'id' => 0,
'name' => 'test text',
],
];
$nodes = [
[
'id' => 0,
'title' => 'Chapter 1',
'textId' => 0,
'parentNodeId' => null,
],
[
'id' => 1,
'title' => 'Section 1.1',
'textId' => 0,
'parentNodeId' => 0,
],
[
'id' => 2,
'title' => 'Page 1.1.1',
'textId' => 0,
'parentNodeId' => 1,
],
];
$fileDataMap = [
'texts.json' => $texts,
'nodes.json' => $nodes,
];
foreach ($fileDataMap as $file => $data) {
$path = __DIR__ . "/$file";
file_put_contents($path, json_encode($data, JSON_PRETTY_PRINT));
}