<?php
$DATABASE = [ [ 'id' => '001' ] ];
?>
class Model {
constructor() {
this.data = <?php print(json_encode($DATABASE)); ?> ;
}
async fetchList() {
return this.data.map(item => ({"id": item.id}));
}
async fetchItem(identifier) {
// TODO Iterate this.data and find the right item.
}
}